Viewstate expires?

C

Chris Davoli

I store some stuff in view state and then if I leave the browser instance
alone say for 20 minutes, it gives me this message when I go to retrieve from
viewstate. Before it expires it works perfectly. Is there anything I can do
to not have it expire? Or what is it doing?

IT HIGHLIGHTS IN RED LINE 334

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:


Line 332: End If
Line 333:
Line 334: If
ViewState("SpecialInstructions").ToString.Trim.Length > 0 Then
Line 335: lblSpecialInstructions.Text =
ViewState("SpecialInstructions").ToString
Line 336: pnlSpecialInstructions.Visible = True
 
B

bruce barker

if your application timeouts, then on the postback when its restarted, a
new encryption key is assigned, thus it can not unencrypt the old viewstate.

you can preassign the encrypton key in the web config. see the
machinekeyentry in the web.config

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top