Viewstate expires?
am 28.01.2008 18:13:00 von ChrisDavoli
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
--
Chris Davoli
Re: Viewstate expires?
am 28.01.2008 19:36:07 von DFS
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)
Chris Davoli wrote:
> 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
>
>