Why Response.Redirect is not working in Session_End event?

G

Guest

Hi,
Im trying to use Response.Redirect in Session_End event in Global.asax page,
which is not working. Why this is not working? And if this not works here,
how do I hanlde this? Any possible and best solutions will be helpful.

N.B.: Here my intention is to redirect to, say Login page, when the user
session ends.

Thanks in advance,
K.V.Ravindra Kumar
 
J

Jeffrey Palermo [MCP]

Ravindra,
Sorry, when the session ends, there is not HttpContext. There is no
active page to redirect. A user can close leave their computer and
disconnect from the Internet, and 20 minutes later this code will fire.
There is no user at this point. What you can do is check to see if the user
is logged in (if they have a session). If they don't then redirect to the
login page. Of course, this code would have to run on every page or in the
authenticate request of global.asax.

You can also put this code in your base page so that on every request you
check that the user is logged in. If not, redirect.

Best regards,
Jeffrey Palermo
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top