c# - viewstate is lost after 19+ minutes -


background:

  • aspnet c# 3.5 web application
  • iis 7
  • machine key set in web.config
  • session expiration: 200 min in web.config using <sessionstate timeout="200" />
  • ticket set way:
new formsauthenticationticket(2, ticket.name,                                datetime.now,                               datetime.now.addminutes(200),                                false, ticket.userdata); 

when user stays on same page 19-20 minutes, postback, viewstate seems lost (data stored in viewstate[xxx] null).

i thought viewstate cannot lost send server @ each postback?

my guess combination of settings have in iis , asp.net.

so have in iis enabled application pool recycle on idle time-out, means if in 20 minutes there no requests app pool stop.

what imagine have machinekey set auto means everytime apppool starts generates new key, mean viewstate might using encryption after 20 minutes fails decrypt since key changed based on application pool recycling.

you should in event viewer , see if find messages recycling app pool invalid view state errors. in iis go the application pools page , click advanced settings, can see defaults 20 minutes idle time-out.

here can see defaults 20 minutes


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -