Difference between the Post and Get methods in Form form, Form form postget
Form provides two data transmission methods: get and post. Although they are all data submission methods, they are indeed quite different in actual transmission, and may have a serious impact on data.
The get and post methods in Form correspond to the GET and POST methods in the HTTP protocol during data transmission. The main differences between the two are as follows:
1. Get is used to obtain data from the server, while Post is used to transmit data to the server.
(I think this statement is somewhat ambiguous. Get is generally used to obtain data from the server and then display data on the page. However, Get can also transmit data to the server, such as query, generally, the get method is used to submit query conditions. I hope you can correct the mistakes.)
2. Get adds the data in the form to the URL pointed to by action in the form of variable = value, and the two use "?" And each variable is connected by "&". Post puts the data in the form data body and passes the data to the URL indicated by the action according to the corresponding variables and values.
3. Get is insecure because data is stored in the request URL during transmission, nowadays, many existing servers, proxy servers, or user proxies record the request URL to a log file and place it in a certain place, so that some private information may be seen by a third party. In addition, you can directly view the submitted data in the browser. Some internal messages are displayed in front of the user. All Post operations are invisible to users.
(I personally think: if you use the Get method to submit data, it doesn't matter whether the transmitted data is visible or invisible. The data transmitted in this method is generally displayed on the page, such as query.
If you want to submit data that you do not want to reflect, you can use the Post method. For example, you can strictly view the hidden data.
Of course, similar login scenarios are special cases. Therefore, whether it is safe or not can be said that Post is required for security-related information, but more Post-based data submission is required.)
4. Get transmission has a small amount of data, mainly because it is restricted by the URL length, while Post can transmit a large amount of data, so only Post can be used for uploading files.
5. Get restricts that the dataset value of Form forms must be ASCII characters, while Post supports the entire iso000046 character set.
6. Get is the default Form method.
7. Data transmitted using Post can be correctly converted to Chinese by encoding; the data transmitted by Get is directly transmitted without encoding (the Get encoding method is based on the encoding method specified on the page ).
Example:
1, Get method through the URL request to pass the user's data, the form of each field name and its content, connected to a pair of strings, placed in the action property referred to by the program url, such as http://www.mdm.com/test.asp? Name = asd & password = sad, data will be directly displayed on the url, just as the user clicks a link;
The Post method uses the HTTP post mechanism to place the field names and content in the form in the HTML header and send them to the server for processing by the program indicated by the action attribute, this program reads and processes the form data in the standard input mode.
2. In Get mode, Request. QueryString is used to obtain the value of the variable. In Post mode, Request. Form is used to access the submitted content.
3. The size of data transmitted in Get mode is very small, generally around 2 KB, but the execution efficiency is better than that of Post method. The size of data transmitted in Post mode is relatively large, it is waiting for the server to read data, but there are also byte restrictions. This is to avoid malicious attacks on the server using a large amount of data. According to Microsoft, Microsoft uses Request. the maximum data that Form () can receive is limited. IIS 4 is 80 KB, and IIS 5 is 100 KB.
Suggestion: unless you are sure that the data you submit can be submitted at one time, use the Post method whenever possible.
4. If you submit data in Get mode, security issues may occur. For example, when you submit data in Get mode on a login page, the user name and password will appear on the URL, if the page can be cached or other people can access the customer's machine, the user's account and password can be obtained from the history.
Therefore, we recommend that you use the Post method for form submission. A common problem on the form page submitted by the Post method is that a dialog box is displayed when the page is refreshed.
Suggestion: For security reasons, it is recommended that you use Post to submit data.
Reference: http://www.cnblogs.com/hnrainll/archive/2011/06/07/2074597.html