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

.NET Question

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

Default Text
 

Verified Answer?

The member who asked this question verified this comment provided the solution that solved their problem.

by:Posted on 2008-05-14 at 05:49:36ID: 21563505

Javascript:
function timeout(){window.location = "http://google.com"}

call it in your html:
<body onload="setTimeout('timeout()', 5000)">

But you would still have to put this into every page... not sure how you are going to accomplish this without masterpages.

This content is available to Experts Exchange members

See the answer now
with your Free 30 Day Trial

Get unlimited access to solutions & experts

  • 4,169,477 solved questions
  • 3,805 articles & videos
  • 15,413 tech experts

Get Access Now

Need a customized answer?
Ask your question for one-on-one assistance.

We will never share this with anyone.

Related Questions

See More Programming for ASP.NET Solutions

Related Articles

See More Programming for ASP.NET Articles
Not finding the exact answer you need?

Ask the experts for one-on-one help
with your Free 30-day Trial

Get unlimited access to solutions & experts

  • 4,169,477 solved questions
  • 3,805 articles & videos
  • 15,413 tech experts

Get Access Now

Trusted by Thousands of Top Companies

  • CVS
  • IBM
  • Boeing
  • US Army
  • Kaiser
  • RalphLauren
  • Xerox
  • Cox
  • BlueCross
  • Accenture
  • Sony
  • Toyota
  • Allstate
  • Att
  • TomTom
  • BBC
  • Raytheon
  • Wells Fargo
  • US Navy
  • Direct TV
  • FootLocker
  • Nikon
  • BritishCouncil
  • TS Army
201503-LO-Qu-039

Experts Exchange members save,
on average, 2.5 hours per week.

- 2014 EE Annual Survey

Related Questions We have nearly 4 million solutions here.

See More Programming for ASP.NET Solutions

Experts Exchange powers the growth and success
of technology professionals worldwide.

  • Solve

    Experts Exchange is the tech professional’s trusted, on-demand resource for solving difficult problems, making informed decisions, and delivering excellent solutions.

  • Learn

    With unparalleled access to technical experts, verified real-world solutions, and diverse educational content, Experts Exchange enables personalized development of technology skills.

  • Network

    Experts Exchange gives you the professional exposure and valued relationships key to building the career you want.

Join the Network Today

See Plans and Pricing