Connecting Tech Pros Worldwide Forums | Help | Site Map

Session timeout in asp.net with C#

Newbie
 
Join Date: Jan 2008
Posts: 1
#1: Jan 9 '08
We have used the session to get redirect the page when the session is timeout. But unfortunately, it is not fine. We have many steps to use to solve this problem but not set. It stands only upon 10 minutes.

Our steps below:

1. Default timeout 30 is set in the Sessionstate of web.config.
<sessionState timeout=”30” />

2. we have to use Global.asax file

void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
Response.Redirect("Default.aspx");
}

3. we have to set the authentication form to timeout
<forms name="myAuth" loginUrl="Default.aspx" timeout="30" />


The problem is occurred. See the below paragraph:
“Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.”


Please, give me any suggestions to this problem.
kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#2: Jan 9 '08

re: Session timeout in asp.net with C#


Timeout is usually in seconds, I believe that 10 mins is the default. You might want to try the session_end event instead. HTH.
Reply