Reputation: 10978
background:
web.config
web.config
using <sessionState timeout="200" />
new FormsAuthenticationTicket(2, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(200), false, ticket.UserData);
When user stays on same page for 19-20 minutes, then do a postback, viewstate seems to be lost (data stored in ViewState[xxx]
is null).
I thought that viewstate cannot be lost as it is send back to server at each postback?
Upvotes: 1
Views: 1934
Reputation: 11
Do you have ASP stateserver enabled? Probably in web.config. Check the timeout.
Upvotes: -1
Reputation: 13591
My guess would be that this is a combination of settings that you have in IIS and ASP.NET.
So you have in IIS enabled Application Pool recycle on Idle time-out, that basically means that if in 20 minutes there are no requests then the App Pool will stop.
What I also imagine is that you have MAchineKey set to Auto which means everytime the AppPool starts it generates a new key, what that could mean is that as your ViewState might be using encryption then after 20 minutes it fails to decrypt since the key changed based on the Application Pool recycling.
You should look in the Event Viewer and see if you find messages about WAS recycling an app Pool as well as invalid View State errors. In IIS go the the Application Pools page and click the Advanced Settings, you can see the defaults are actually 20 minutes for idle time-out.
Upvotes: 3