ASP. NET: Summary of State-State management in ASP. NET (1)

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.