Connecting Tech Pros Worldwide Forums | Help | Site Map

Session timeout - WebForm

mg
Guest
 
Posts: n/a
#1: Nov 18 '05
What code will automatically launch a WebForm (C#) when the session timeout (set in Web.config) has elapsed

Ismail Rajput
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Session timeout - WebForm


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" <mg@theworld.com> wrote in message
news:63ADF33A-A00F-4826-9923-BA4E3E71F199@microsoft.com...[color=blue]
> What code will automatically launch a WebForm (C#) when the session[/color]
timeout (set in Web.config) has elapsed


Ismail Rajput
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Session timeout - WebForm


sorry i could not see c# in your question , but idea is same.
"Ismail Rajput" <human_to_human@hotmail.com> wrote in message
news:%23q$v4JM%23DHA.132@TK2MSFTNGP09.phx.gbl...[color=blue]
> 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" <mg@theworld.com> wrote in message
> news:63ADF33A-A00F-4826-9923-BA4E3E71F199@microsoft.com...[color=green]
> > What code will automatically launch a WebForm (C#) when the session[/color]
> timeout (set in Web.config) has elapsed
>
>[/color]


mg
Guest
 
Posts: n/a
#4: Nov 18 '05

re: Session timeout - WebForm


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
Ismail Rajput
Guest
 
Posts: n/a
#5: Nov 18 '05

re: Session timeout - WebForm


then you need to put this code into global.ascx

sub session_end()

response.redirect("formpage.aspx")

end sub


"mg" <mg@theworld.com> wrote in message
news:3D06012F-F03A-4E11-B1F1-CF8BC62A0C66@microsoft.com...[color=blue]
> 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[/color]
running Response.Redirect() without having to run the if( ) ?. Say, for
example, using Session_End in Global.asax.cs


mg
Guest
 
Posts: n/a
#6: Nov 18 '05

re: Session timeout - WebForm


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")
}
Closed Thread