Q

Question

How to redirect to login page automatically, after session time out.

How to redirect to login page automatically, after session time out?
In my web application, user logs in in the application, after a certain time (30 mins) session times out and login page appears only AFTER user action.
I would like to redirect the user back to the login screen automatically (before user performs any action) after session has timed out.

Your suggestions will be greatly appreciated.

I used following code in pagerender of masterpage.
 
 HttpContext.Current.Response.AppendHeader("Refresh", Convert.ToString(((HttpContext.Current.Session.Timeout * 60) - 5)) + "; Url=homepage.aspx")
 
Also, i have Session_Start/Session_end in global.asax.

                                
1:
2:
3:
4:
5:

Select allOpen in new window

201409-LO-Qu-017

Get Smarter with
Programming for ASP.NET


118,306

Answers


2,500+

Articles & Videos


19,514

Contributors

Ask the Programming for ASP.NET Experts Your Question

Sign Up to Ask

Cancel anytime

What does a Premium Membership get you?

  • Unlimited Access to over 4 million verified technology solutions

  • Unlimited Access to thousands of interactive articles and videos

  • Unlimited technical writing assistance

  • Submit your projects for Expert Testing

  • Expand your professional network with our messaging and hire me features

  • Ad free and mobile optimized experience

Join the Network Today!

See Plans and Pricing