Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / Redirect to Error Page on ASP.NET Web Forms Session Timeout

Redirect to Error Page on ASP.NET Web Forms Session Timeout

New Discussion
Nancy
Nancy asked on Feb 7, 2012 5:44 PM

Hi,

In my website I have around 10 screens, each of which display a session variable.

I have seen that the function  void Session_End(object sender, EventArgs e) of Global.asax is called when session expires. But redirecting to session timeout page by doing  Response.Redirect will not work there.

 

Can anyone please help me with a way to redirect to error page from Session_End function of Global.asax.

You are most welcome to give me any other approach to handle session timeout at one place, instead of checking session variables in each and every screen and appropriately redirecting to error page.

Sign In to post a reply

Replies

  • 0
    [Infragistics] Nikolay
    [Infragistics] Nikolay answered on Jan 26, 2012 1:19 PM

    Hello nancy1985,

    I suggest that you take a look at the following forum thread, discussing similar issue – http://forums.asp.net/t/1137344.aspx.

    I hope this helps.

    • 0
      [Infragistics] Nikolay
      [Infragistics] Nikolay answered on Jan 31, 2012 10:38 AM

      Hi nancy1985,

      If you still need assistance on the matter, please do not hesitate to ask.

      • 0
        Nancy
        Nancy answered on Jan 31, 2012 3:32 PM

        Hi Nikolay,

        I have gone through the link and have found out that the only way to achieve this is to check the session status in each and every page and redirect to an appropriate error page if session is invalid.

        Please let me know if otherwise.

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Feb 1, 2012 10:06 AM

        Hi nancy1985,

        This is one possible approach. You could also handle the session end using javascript, similar to the following:

                 var sessionTimeout = "<%= Session.Timeout %>";

                $(document).ready(HandleSessionEnd());

         

                function HandleSessionEnd() {

                    sessionTimeout = sessionTimeout – 1;

                    if (sessionTimeout >= 0) {

                        //call the function again after 1 minute delay

                        window.setTimeout("HandleSessionEnd()", 3000);

                    }

                    else {

                        window.location.replace("Relogin.aspx");

                    }

                }

         

        Let me know if you have any questions.

      • 0
        [Infragistics] Nikolay
        [Infragistics] Nikolay answered on Feb 6, 2012 5:59 AM

        Hello nancy1985,

        If you have any other questions, please feel free to contact me.

      • 0
        Nancy
        Nancy answered on Feb 7, 2012 5:44 PM

        Thanks David Young.

        I took up the approach of checking the Session validity in the Page_Load and acting accordingly.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Nancy
Favorites
0
Replies
6
Created On
Feb 07, 2012
Last Post
14 years ago

Suggested Discussions

Tags

No tags

Created by

Created on

Feb 7, 2012 5:44 PM

Last activity on

Feb 11, 2026 8:59 PM