Today in the company unexpectedly someone asked me viewstate principle. Actually, the most basic thing about this thing. May be said on the internet a little general. I will now share my personal understanding:
First, after the browser has sent the request to the server side, the server will accept the request to see the viewstate sent by the client (whether it is created by a custom or service control).
He will automatically create a __viewstate (this you don't have to worry about __viewstate) what the hell. Can be used when he is a temporary stored variable (in the. NET may be called a hidden field).
This stuff is, of course, after BASE64 encryption is returned to the browser side (this encryption process is done in the Saveallstate method in the SaveState event of the page life cycle. )
When the browser submits the form, the __viewstate hidden field is also submitted to the server at this time ReadState event of the page life cycle
The Readallstate method decrypts the encrypted value back to Base64 and finally assigns the value to the viewstate named name.
Finally, to manipulate the values in ViewState
. The principle of viewstate in net