Dear all, I built web application with C# and SQL Server. The problem is that when I run the web application for a certain time say about 5 minutes and click the drop down list. The page stop loading and all other hyperlink inside the application was killed.
The session tag in web.config is the default value and I have set cookie value expire after logout. I don't know what happen to session. Could anyone tell me the problem? Waiting for reply!! Thanks!! Attach code for login success page and web.config
/*
* GetSessionValue() is to read session value which is already set in Login page
* */
private void SetSessionValue()
{
if (Session["sid"]!=null)
{
//read staffID and staffPcode session value
lblStaffId.Text = Session["sid"].ToString();
lblStaffPcode.Text = Session["pcode"].ToString();
}
else
{
Server.Transfer("//SMS/LoginUser/Login.aspx");
}
}
/*
* SignOutUser() is to perform session clearance and cookies expiration
* when user click logout
* */
private void SignOutUser()
{
Session.Clear();
Session.Abandon();
Response.Cookies["myCookie"].Expires = DateTime.Now;
Server.Transfer("//SMS/LoginUser/Logout.aspx");
}
/*
* btnLogout_Click() is to perform basic logout operation when user click
* */
private void btnLogout_Click(object sender, System.EventArgs e)
{
SignOutUser();
}
Roy Ng
Member
535 Points
107 Posts
Session Expire Problem
Mar 28, 2004 01:47 PM|LINK
/* * GetSessionValue() is to read session value which is already set in Login page * */ private void SetSessionValue() { if (Session["sid"]!=null) { //read staffID and staffPcode session value lblStaffId.Text = Session["sid"].ToString(); lblStaffPcode.Text = Session["pcode"].ToString(); } else { Server.Transfer("//SMS/LoginUser/Login.aspx"); } } /* * SignOutUser() is to perform session clearance and cookies expiration * when user click logout * */ private void SignOutUser() { Session.Clear(); Session.Abandon(); Response.Cookies["myCookie"].Expires = DateTime.Now; Server.Transfer("//SMS/LoginUser/Logout.aspx"); } /* * btnLogout_Click() is to perform basic logout operation when user click * */ private void btnLogout_Click(object sender, System.EventArgs e) { SignOutUser(); }