Preface
We used to use a single machine when learning computers.ProgramThat is, a program running on a computer. With the development of the program, the C/S structure emerged, and then the B/S structure emerged. The most popular structure is the B/S structure, the B/S structure is greatly different from the standalone application and the C/S structure application. An important question is how to save the data? That is, how to transmit data from one page to another? How to share data among many pages? Here we have to talk about the state in ASP. NET. Since it is a B/S structure, of course there are client-based state management cookies and server-based state management sessions.
HTTP Overview
Besides, Asp. before the net status, let's talk about an http protocol. In the B/S structure, an important transmission protocol is the HTTP protocol, which is a "stateless" protocol, why is it a stateless protocol? After you access a page, it will send you the requested resources, discard the page variables, control attributes, and so on. For example, anyone who has done ASP knows that on a pageEnter "Zhang San" in the input file. After you refresh the page, the value in the page will be empty, as shown in figureFor example, if you fill in a large amount of information when registering a member on some websites, When you click the "Submit" button to send it to the server, the server returns an incorrect message, it is very painful to enter all the values in the text box one by one. From this point of view, it discards the properties of the control and does not save the data, therefore, from the HTTP protocol, your page is completely independent from the next page you want to jump to. There is no connection between the two pages as the HTTP protocol, therefore, ASP is required to transfer data on two pages. net status, someone will say in ASP.. net, drag and drop a labelcontrol inCodeSet its text attribute as follows: "My name is Li Si" this. label1.text = "My name is Li Si". After refreshing the page, "My name is Li Si" is still there because of ASP. all controls in. Net have a common property viewstate, which defaults to true. If you set the value of label1's enbleviewstate to false, refresh the page, the "My name is Li Si" is missing, so the viewstate is ASP. net is specially designed to store data between pages.
Essentially, ASP. NET is a technology that shares data by transferring data between pages.