How to clear session when i close a aspx.

3 posts, 1 answers
  1. Kem Arda
    Kem Arda avatar
    49 posts
    Member since:
    Jul 2009

    Posted 20 Oct 2009 Link to this post

    Using RadWindowManager, I pop up an aspx page. And when i close it from (X ) i just wantto fire and event and clear/abondon session. How can i do that?

    Thanks...
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Oct 2009 Link to this post

    Hi Kem,

    Attach OnClientClose event to RadWindow and inside the event handler, invoke an ajaxRequest(). In the AjaxRequest server side event handler you can clear the session.

    JavaScript:
     
    <script type="text/javascript"
        function OnClientClose() { 
            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
            ajaxManager.ajaxRequest(arguments); 
        } 
    </script> 

    C#:
     
    protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) 
        Session.Clear(); 

    -Shinu.
  3. Kem Arda
    Kem Arda avatar
    49 posts
    Member since:
    Jul 2009

    Posted 21 Oct 2009 Link to this post

    That just works, thanks Shinu.
Back to Top