how to redirect to loginpage after session timeout


Ather Ali Shaikh

I am using Forms Authentication. but the page is not redirect to desired
login page after session is expired.
When I debug the application. Session_end is called.
In the Session_End method I write code to redirect to the LoginPage as
(response.redirect("Login.aspx") or server.transfer("Login.aspx")).
But it is not redirecting. It runs the redirecting code but physically not

What should I do more.?

Ather Ali




Keep in mind that all web sessions are disconnected. With that said,
once a person loads a page from the web server, no code that runs on the
server can affect that person because they are disconnected.

The server will handle killing of the user's session so the next time
they request a page, they will need to authenticate. However, to enforce
this on the client, you can use Meta Refresh or Javascript to redirect
them to onther page after their time is expired.

Personally, I would be be careful about what you impose on the client. A
user might not be happy about having their browser page redirected if
they are in the middle of reading a sentence or just about completed with
a long form.