What does this ASP viewstate mean?
I'm scraping an asp.net web-form and it always sends viewstates like this:
<input type="hidden" name="__VIEWSTATE" value="/wEXAQUDX19QDwUNZnJtQ291cnNlSW5mbw8GblQKzmHhzYgCAw==">
When I decode it in the View State decoder I get this object: System.Collections.Hashtable
.
The precise value of the __VIEWSTATE varies,开发者_Python百科 but it alwasy decodes to the object System.Collections.Hashtable
.
What's going on here? Why does the viewstate value vary but always decode to that?
The Page is stateless and so after each postback, it has no idea what happened before. A ViewState is often used in order to persist the information between postbacks. For example, if you selected an option and created a postback, the site might store your option in a ViewState so that your option is still selected after a postback.
What your seeing is the ViewState storing information on what controls are currently rendered on the site (a Hashtable in this case). The values stored in the table may vary, but the control seems to be present between postbacks.
You can read more on ViewStates on MSDN and how/when to use them here.
精彩评论