code to handle session timeout?

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???
 
N

Natty Gur

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top