code to handle session timeout?

  • Thread starter Thread starter D
  • Start date Start date
D

D

In my global.asax file, I have in Session_End(Object sender, EventArgs e)
Server.Transfer("logon.aspx");

Because I want to have my user relogon. But it simply does not work. I
keep getting the null exception error because the Session no longer contains
the object that I have stored. I am trying to redirect my user gracefully
back to the login page with a message that informs them of the timeout.

I know it is a simple thing, but still have not been able to work it. If
Session_End in global.asax file does not serve this purpose, then what is it
for???
 
Hi,


Session_End is there for cleaning resources that you put inside session
variables.
Server.Transfer won't work because the session end event isn't connect
to any request of the client (every request start context and session
end don’t run in such a context. It fire when there isn’t any client
request for predefine time) so there’s no one to transfer to.


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
 
Back
Top