The session will always exist probably because when your session expires and you access a page again it just makes up a new session for you.
One thing you can do is the first time you access the app just set a session variable like:
Session["LoggedIn"] = "1";
Then check to see if it exists. If it doesn't then you know the session has been expired and recreated so you can boot them back.
if (Session["LoggedIn"] == null)
{
Response.Redirect("YourSignInPage.aspx");
}
else
{
// Do whatever you were going to do.
}
No comments:
Post a Comment