There are two ways to submit a form. One is the get method and the other is the post method. Let's look at the following code and understand the difference between the two submission methods:
Get method Transfer
<Html xmlns = "http://www.w3.org/1999/xhtml">
Public partial class Default3: System. web. UI. page {protected void Page_Load (object sender, EventArgs e) {string id = Request. queryString ["name"]; string website = Request. queryString ["website"]; Response. write ("input id is" + id); Response. write ("<br>"); Response. write ("input name" + website );}}Post method Transfer
<Html xmlns = "http://www.w3.org/1999/xhtml">
Public partial class Default3: System. web. UI. page {protected void Page_Load (object sender, EventArgs e) {string id = Request. form ["name"]; string website = Request. form ["website"]; Response. write ("input id is" + id); Response. write ("<br>"); Response. write ("input name" + website );}}
Urlhttp: // localhost: 1092/SlwyWeb/Default3.aspx of the get method? _ VIEWSTATE = % 2fwepdwuklt1_otizodqwnwrk2hgzoy1tun1xdnu % 2BUD9XgpNyjdfyAmJtrK % 2Fh2qQ9sa4% 3D & name = 12 & website = 12 & Button1 = send
Post method Urlhttp: // localhost: 1092/SlwyWeb/Default3.aspx? Name = & website = & Button1 = send
It can be seen that the value of the post method is not stored in the url.
So where is the value of the post method stored?
Why is there a _ VIEWSTATE = % 2fwepdwuklt1_otizodqwnwrk2hgzoy1tun1xdnu % 2BUD9XgpNyjdfyAmJtrK % 2Fh2qQ9sa4% 3D string in the get Method url?
1. get is to add the parameter data queue to the URL referred to by the ACTION attribute of the submission form. The values correspond to each field in the form one by one and can be seen in the URL. Post uses the HTTP post mechanism to place fields in the form and their content in the html header and send them to the URL address referred to by the ACTION attribute. You cannot see this process.
2. For the get method, the server uses Request. QueryString to obtain the value of the variable. For the post method, the server uses Request. Form to obtain the submitted data.
3. The data volume transmitted by get is small and cannot exceed 2 kb. The amount of data transmitted by post is large, which is generally not restricted by default. Theoretically, the maximum size of IIS4 is 80 KB, and that of IIS5 is 100KB.
4. Low get security and high post security. However, get is more efficient than Post.