Does viewstate getting send in httprequest.

  • Thread starter Thread starter archana
  • Start date Start date
A

archana

Hi all,

Can anyone tell how viewstate is gets stored in subsequent http
request.

Does viewstate is getting send along with hptt request?

Any help will be truely appreicated.
 
Hi all,

Can anyone tell how viewstate is gets stored in subsequent http
request.

Does viewstate is getting send along with hptt request?

Any help will be truely appreicated.

ViewState is sent as part of the body for the HTTP Post of the page.
If you look at the HTML source of your page, you can see the ViewState
hidden field and it's value. That value is then sent back to the page
along with the value of the other input elements in the page.

If you want to see the contents of the ViewState, you should use a
tool like Nikhil's K. WebDevHelper: http://projects.nikhilk.net/Projects/WebDevHelper.aspx

Hope this helps yout.
 
Indeed, Nikhil K's blog is the place to search for information (since
he is the guy who invented the thing). But basically, imagine that
ViewState is simply a base64 encoded string storing the state of your
current form. This string is by default stored in a hidden input in
the page called "__VIEWSTATE" and in your HTML dump may look something
like:

input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/
wEPDwULLTEwbqZpA" />

After postback, the value is sent back to the server and state is
restored. This happens in the LoadViewState phase of the page, which
happens immediately after Init and before Load (Page_Load).

If you think this bloats the page, you have two options:

1) Disable ViewState altogether - however, you will need to invent
your own state persisting logic (typically, rebind everything upon
each request to the page)
2) Override the curiously called:

Page.LoadPageStateFromPersistenceMedium
Page.SavePageStateToPersistenceMedium

methods and store the ViewState in Session, Cache, etc, etc. This is
relatively hard to do, the following article has details:

http://www.codeproject.com/aspnet/PersistentStatePage.asp
 
Back
Top