Viewstate
The value of viewstate is stored in the HTML of the browser. CodeWhen the browser is closed, the value disappears, that is, viewstate is passed between functions on this page. Why is this method used? Because after an event occurs, the page may be refreshed. If global variables are defined, viewstate is used.
Session
Session uses key-value pairs, that is, the ID stores the client, and the value is placed on the server. The user ID is used to find the corresponding value on the server. In this way, the value is placed on the server, there is a time limit. When the time is reached, the server will be automatically released.
Cookie
Cookies can be stored in a browser variable. One method is to save the value in the browser variable. When the browser is closed, the cookie ends. The other method is to save the cookie to the hard disk, as long as the time does not expire, you can use it again next time.
Http://bvbnm.itpub.net/post/22578/199955: