The form provides two ways to transmit data--get and post. Although they are all methods of data submission, they are quite different in actual transmission and can have a serious impact on the data. Although the Web container has shielded some of the differences for the convenience of getting variable values, it is also helpful to understand the differences between the two in future programming.
The Get and post methods in the form, respectively, correspond to the Get and post methods in the HTTP protocol during data transfer. The main differences are as follows:
1, get is used to obtain data from the server, and post is used to pass data to the server.
2. Get adds the data in the form in the form of Variable=value, followed by the URL to which the action points, and both use "?". connections, and each variable is connected by a "&" connection; Post is the data in the form that is placed in the data body of the forms, in the same way that the variables and values are passed to the URL that the action points to.
3, get is not safe, because in the transmission process, the data is placed in the requested URL, and now many existing servers, proxy servers or user agents will log the request URL to the journal file, and then put in a place, so that there may be some privacy information to be seen by third parties. In addition, users can see the submitted data directly in the browser, and some system internal messages will be displayed in front of the user. All the actions of the post are not visible to the user.
4, get transmission of small amount of data, mainly because of the URL length limit, and post can transfer a large amount of data, so the upload file can only use post (of course, there is a reason, will be mentioned later).
5. Get restricts the value of the data set for form forms to be ASCII characters, while Post supports the entire ISO10646 character set.
6, get is the default method for form.
The data transferred by post can be converted to Chinese correctly by encoding, while the data of get is not changed. In future procedures, we must pay attention to this point.
_________________________________________________________________________________________________
1. The Get method passes the user's data through a URL request, connecting the field names in the form with their contents, paired strings, and placing them in the URL of the program referred to by the Action property, such as http://www.mdm.com/test.asp?name=asd& Password=sad, the data will be displayed directly on the URL, just as the user clicks on a link, and the Post method passes the HTTP post mechanism to place the field names within the form with their contents in the HTML header (header) to the server side by action property can be referred to by the program processing, the program through the standard input (stdin) method, the form of data read out and processed
2, get method needs to use Request.QueryString to obtain the value of the variable, and the Post method through the Request.Form To access the submitted Content
3, the Get method transmits the amount of data is very small, generally limited to about 2 KB, but the execution efficiency is better than the Post method, and the post way to pass the amount of data is relatively large, it is waiting for the server to read the data, but there is a byte limit, This is to avoid malicious attacks on the server with a large amount of data, according to Microsoft, Microsoft to use Request.Form () can receive the maximum data limit, IIS 4 KB bytes, IIS 5 in the KB bytes
recommended: Unless you are sure that the data you submit can be a Secondary submission, or try to use Post method
4, get method to submit data, will bring security issues, such as a landing page, through the Get method to submit data, the user name and password will appear on the URL, if the page can be cached or other people can access the customer this machine, The user's account number and password can be obtained from the history, so the form submission is recommended using the Post method; The common problem with the form page submitted by the Post method is that if the page is refreshed, a dialog box is suggested
: For security reasons, it is recommended that you use post to submit data