Viewstate expires

C

Chris Davoli

I wqas told to put a machine key into the web config so it would do the
encryption the same. I did that and I still get the following error. Any
other suggestions?

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

are you checking IsPostback before accessing viewstate for saved values?

most likely you have redirect logic on expired session or authentication,
and the page request is a get (no viewstate passed).


-- 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,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top