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

Close Radwindos after session expired

1 Answer 55 Views
Window
This is a migrated thread and some comments may be shown as answers.
Leandro
Top achievements
Rank 1
Leandro asked on 14 Sep 2012, 06:17 PM
Good afternoon,


I have a little problem and I can not find solution for the same.
I'm using a modal window through the "window.radopen", so that when the session expires and the window is still open, if the user triggers an event in it, it is redirected to the login page.
I'd like to do a check that if the session has expired if, out instead of redirecting to the login page, I would like to fire a command to close it.

Well I tried to do this on page load the modal window: 

function GetRadWindow() {
    var oWindow = null;
    if(window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}
function Close(){
    GetRadWindow().close();
}

Protected Sub Page_Load(ByVal sender as Object, ByVal e As System.EventArgs) Handles Me.load
 
    If User.Identity.IsAuthenticated = true Then
        '(...)
    Else
        RadScriptManager.RegisterClientScriptBlock(Me, [GetType()], "mykey", "Close();", True)
    End
 
End sub

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 17 Sep 2012, 11:48 AM
Hi Leandro,

What I can suggest is that you examine this article on registering a script from the code-behind:
http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-javascript-from-server-side.html. I have found the ScriptManager.RegisterStartupScript() method to be the most reliable for the job. Once your conditions are met you can prevent the redirect and call the JS function to close the RadWindow. The main problem would be preventing the forms authentication redirect, but this is not related to the RadWindow.


Greetings,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Leandro
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or