Session timeout - WebForm

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What code will automatically launch a WebForm (C#) when the session timeout (set in Web.config) has elapsed
 
you can use a session variable like

session("checktimeout") = "Notempty"

This session variable will be available untill session Timeout Occurs and
here you can use it like this

If session("checktimeout") = "" Then
Response.Redirect("webform.aspx")
End If

mg said:
What code will automatically launch a WebForm (C#) when the session
timeout (set in Web.config) has elapsed
 
This code is simple and elegant. I hadn't thought of it

But, is there a way of checking for the session timeout automatically and running Response.Redirect() without having to run the if( ) ?. Say, for example, using Session_End in Global.asax.cs
 
then you need to put this code into global.ascx

sub session_end()

response.redirect("formpage.aspx")

end sub


mg said:
This code is simple and elegant. I hadn't thought of it.

But, is there a way of checking for the session timeout automatically and
running Response.Redirect() without having to run the if( ) ?. Say, for
example, using Session_End in Global.asax.cs
 
I can't get WebForm1 to load load automatically after a session timeout, with the following code. How can I do so

In Web.config

<sessionState
mode="InProc
timeout="1"
/

In Global.asax.cs

protected void Session_End(Object sender, EventArgs e

Response.Redirect("WebForm1.aspx")
}
 
Back
Top