Session timeout when child RadWindow is open

2 posts, 0 answers
  1. Backend
    Backend avatar
    1 posts
    Member since:
    Jul 2014

    Posted 24 Jul 2014 Link to this post

    Hello,

    I am working on session handling for my project.

    I have a parent aspx page which holds RadGrid. On RadGrid row click, new RadWindow opens new aspx page using javascript function - 

                function RowDblClick(sender, eventArgs) {
                    var wnd = window.radopen("url");
                    wnd.setSize(960, 700);
                    wnd.Center();
                }

    To get server know that session has expired, meta information header is used in each Page_Load event which refreshes page after 1 second of session timeout - 
             
                     Response.AddHeader("Refresh",Convert.ToString((Session.Timeout * 60) + 1));

    After refresh if there is new session, then page is redirected to Login page.

    This woks fine until there is timeout when RadWindow is open on parent page. If Radwindow is open, after refresh due to session timeout it just close down itself and browser displays parent aspx page with RadGrid.
     
    The problem is how and where server can know that RadWindow is closed (which event) and as RadWindow is closed server do not have any handle to it so how can parent aspx page redirected to login page. In short, how server can first close RadWindow on parent aspx page and then redirect parent aspx page to login page.

    Thanks! 

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Jul 2014 in reply to Backend Link to this post

    Hi,

    The server side event Unload will fire both on page load time and RadWindow closing time. So there you can write a logic to achieve your scenario. When the session expiration is happening Session_End event in Global.asax will fire. There you can set a flag variable and check the falg variable value in the RadWindow Unload as follows.

    Global.asax:
    void Session_End(object sender, EventArgs e)
    {
        Application["Flag"] = "1";
    }

    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        Application["Flag"] = "0";
        Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) ));
    }
         
    protected void rwindow1_Unload(object sender, EventArgs e)
    {
        if (Application["Flag"].ToString() == "1")
        {
            //your logic
        }
    }

    Thanks ,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top