Stateless http page

Source: Internet
Author: User

The http protocol is stateless and does not remember what happened on the previous page ". The server does not remember what the browser gave last time. The Browser needs to remember these values (input is recorded in value, and other values are placed in hidden fields, such as viewstate ), the next time I submit the application, I will send it to the server to achieve interaction! Disadvantages of storing status information in hidden fields: increasing website traffic, reducing access speeds, and placing confidential data in a form may cause data spoofing security issues! Therefore, the Session and Cookie mechanisms are generated to supplement this. Let's look at the following small example:

View Code

Public partial class WebForm1: System. Web. UI. Page
{// If a request is not accepted, a new WebForm1 object will be processed and released after processing. Therefore, each request is a new page object.
Private int I = 0;
Protected void button#click (object sender, EventArgs e)
{
I ++; // Q: Will the printed value automatically increase when I click the button? No. Each time it is 1.
Response. Write (I. ToString ());
}
Protected void Page_Load (object sender, EventArgs e)
{

}
}

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.