This is a migrated thread and some comments may be shown as answers.

Session timeout when child RadWindow is open

1 Answer 53 Views
Window
This is a migrated thread and some comments may be shown as answers.
Backend
Top achievements
Rank 1
Backend asked on 24 Jul 2014, 09:43 AM
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! 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 25 Jul 2014, 07:50 AM
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.
Tags
Window
Asked by
Backend
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or