Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is ViewState session cleared ?

I know SessionState is Cleared when the session dies - usually after 20min of inactivity. My question is when does ViewState session dies ? Or does it never dies ? Is there any way to clear it ?

like image 403
HereToLearn_ Avatar asked Dec 20 '22 13:12

HereToLearn_


2 Answers

Viewstate lasts for as long as it's on the page - it's outputted with the HTML; check the source to your rendered page and you will see a load of text in a hidden field.

Something like:

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNTIyODQ4NzI.....

Once the page is gone, it's gone.

You can clear it by calling

ViewState.Clear()
like image 134
Darren Wainwright Avatar answered Jan 02 '23 17:01

Darren Wainwright


Old ViewState, like old soldiers, never dies, it just fades away...

It's stored in hidden fields in the HTML page, and stays alive in the browser's cache.

like image 33
Joe Avatar answered Jan 02 '23 18:01

Joe