Click here to Skip to main content
15,922,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i am developing a web application in which i want to check wheather session has expired or not if expired user has to redirect to login page can anyone help me out
Posted
Comments
Sandeep Mewara 30-Dec-10 0:40am    
There can be various questions around yours. What type of login? Why re-direction to login? Is session driving force of page display?

But for now, the answer given suffices what you asked. So all good! :)

1 solution

In Login page. Login button click Event
Session["User"] ="XXXX";


In other pages. Page_Load event
if(!IsPostBack)
{
  if(Session["User"]! = null)
   {    
    // Do what ever you want
   }
  else
   Response.Redirect("Login.aspx")
}


Have a look on CP Article Exploring Session in ASP.Net[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900