Hi,
the logout button clear the session using the code below and then redirect to login
page.
FormsAuthentication.SignOut();
Session.Clear();
Session.Abandon();
Then, each page call a function ValidateSession() in a class checkLogIn as
CheckLogIn.ValidateSession() in page load event.
the function ValidateSession() as below,
public static void ValidateSession()
{
try
{
string sUserId = System.Web.HttpContext.Current.Session["UserId"].ToString();
}
catch (Exception oException)
{
System.Web.HttpContext.Current.Session["UserId"] = "sessionOut";
System.Web.HttpContext.Current.Response.Redirect("~/Account/Login.aspx");
}
}
Then, check the session, Session["LoginId"] in page load event of login page.
as below
if (Session["UserId"] != null)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alertscript", "find()", true);
}
But the Session["UserId"]==null.why?
Thanks..