The difference between post and get has recently looked at the QQ protocol and found that post and get are really important. It can also be very advanced, but if you do not know these two things, sometimes it is very troublesome.
There are 5 Differences Between get and post methods in Form submission.
1. Get is to get data from the server, and post is to send data to the server.
2. Get refersParametersThe data queue is added to the URL referred to by the Action attribute of the submitted form. The values correspond to each field in the form one by one and can be seen in the URL. By using the httppost mechanism, each field in the form and its content are placed in the HTML header and transmitted to the URL address referred to by the Action attribute. You cannot see this process.
3. 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.
4. 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.
5. Low get security and high post security.
HTTP Request: difference between get and post Methods
HTTP defines different methods for interaction with the server. The most basic methods are get and post. In fact, get applies to most requests, while retaining post is only used to update sites. According to the HTTP specification, get is used to obtain information, and should be secure and idempotent. The so-called security means that this operation is used to obtain information instead of modifying information. In other words, get requests generally do not have side effects. Idempotence means that multiple requests to the same URL should return the same result. The complete definition is not as strict as it looks. Basically, the goal is that when a user opens a link, she can be confident that the resource has not changed from her own perspective. For example, the front pages of news sites are constantly updated. Although the second request will return a different batch of news, this operation is still considered safe and idempotent because it always returns the current news. And vice versa. POST requests are not that easy. Post indicates a request that may change resources on the server. Take news sites as an example.ArticleThe annotation should be implemented through the POST request, because the site is already different after the annotation is submitted (for example, an annotation appears below the article );
If method is not specified during form submission, the default value is get. The data submitted in form will be appended to the URL? Separated from the URL. Alphanumeric characters are sent as they are, but spaces are converted to "+". Other symbols are converted to % XX, where XX is the ASCII (or ISOLatin-1) value of the symbol in hexadecimal notation. The data submitted for the GET request is placed in the HTTP Request Header, while the data submitted for the post is placed in the object data;
Data submitted in get mode can contain a maximum of 1024 bytes, whereas post mode does not.
What is the difference between using "Post" and "get" in a form?
In form, you can use post or get. They are all valid values of method. However, the post and get methods are at least two different in use:
1. The get method transmits user input through URL requests. The post method is in another form.
2. You need to use request. querystring to obtain the value of the variable for get-based submission. When using post-based submission, you must use request. Form to access the submitted content.
Carefully study the followingCode. You can run it to feel it:
Code
<! -- Two forms have different method Attributes -->
<Form action = "getpost. asp" method = "get">
<Input type = "text" name = "text" value = "Hello World"> </input>
<Input type = "Submit" value = "method = get"> </input>
</Form>
<Br>
<Form action = "getpost. asp" method = "Post">
<Input type = "text" name = "text" value = "Hello World"> </input>
<Input type = "Submit" value = "method = post"> </input>
</Form>
<Br>
<Br>
<% If request. querystring ("text") <> "" Then %>
The string passed through the get method is: "<B> <% = request. querystring (" text ") %> </B>" <br>
<% End if %>
<% If request. Form ("text") <> "" Then %>
The string passed through the POST method is: "<B> <% = request. Form (" text ") %> </B>" <br>
<% End if %>
Description
Save the above Code as getpost. asp and run it. First test the POST method. At this time, the URL of the browser does not change, and the returned result is:
The string passed through the POST method is: "Hello World"
Then test the submission using the get method. Note that the URL of the browser is changed:
Http: // localhost/General/form/getpost. asp? TEXT = Hello + world
The returned result is:
The string passed through the get method is: "Hello World"
Finally, submit the file through the POST method. The URL of the browser is:
Http: // localhost/General/form/getpost. asp? TEXT = Hello + world
The returned result is:
The string passed through the get method is: "Hello World"
The string passed through the POST method is: "Hello World"
Prompt
Submitting data through the get method may cause security issues. For example, a login page. When you submit data using the get method, the user name and password will appear on the URL. If:
1. the login page can be cached by the browser;
2. Others can access the customer's machine.
Then, others can read the customer's account and password from the browser's history. Therefore, in some cases, the get method may cause serious security problems.
Suggestions
In form, the POST method is recommended.
Difference between get and post 2
Get: obtains the information of the resource specified by the request URI in Entity mode. If the request URI is only a data generation process, in the end, the response object will return the resource to which the result of the processing process points, rather than the description of the processing process.
Post: it is used to send a request to the target server, requiring it to accept the entity attached to the request and treat it as an additional sub-item of the resource specified by the request URI in the Request queue, post is designed to implement the following functions in a uniform way:
1: Explanation of existing resources
2: send messages to bulletin boards, newsgroups, email lists, or similar discussion groups.
3: submit data blocks
4: expand through additional operationsDatabase
As described above, get is a request to request data from the server, while post is a request to submit data to the server, the data to be submitted is located in the entity behind the information header.
Very theoretical, but very standard. method = "get" is not to get data from the server. Get and post are only different sending mechanisms, not one sending!
The get method will be displayed in the IE address bar to indicate the value you brought when submitting; the POST method will not
1. Get adds 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. By using the httppost mechanism, each field in the form and its content are placed in the HTML header and transmitted 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. You can use request to obtain parameters in either of the two methods.
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.
5. <form method = "get" Action = "A. asp? B = B "> with <form method =" get "Action =". ASP "> is the same. That is to say, the parameter list on the back of the Action page is ignored, while <forpolichod =" Post "Action =". asp? B = B "> unlike <form method =" Post "Action =" A. asp ">.
In addition, a GET request has the following features: it will add data to a URL and pass the data to the server in this way. Generally, a question mark is used? It indicates the end of the URL address and the beginning of the Data parameter. Each Data parameter in the following parameter appears in the form of "name = value". A connector & is used to distinguish between the parameter and the parameter.
POST requests have the following features: data is stored in the HTTP body. They are organized in different ways, including connection and delimiter, which can hide parameters and transmit large amounts of data, convenient.
Isn't there a large string in the post address bar? Something like bjnghfgreygt
If it is get, it will appear
1. The get method uses a URL request to transmit user data. Each field name and its content in the form are connected to a pair of strings and placed as indicated by the Action attribute. Program After the 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, place the field names and content in the form in the HTML header and send them to the server for processing by the program that can be referred to by the Action attribute. The program will pass the standard input (stdin) to read and process the form data.
2. The get method uses request. querystring to obtain the value of the variable. The post method uses request. Form 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 size that form () can receive is limited. In IIS 4, it is 80 KB, and in IIS 5, it 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 users can access the customer's machine, the user's account and password can be obtained from the history. Therefore, the POST method is recommended for form submission; A common problem on the form page submitted by the post method is that if the page is refreshed, a dialog box will pop up.
1. Get adds 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. By using the httppost mechanism, each field in the form and its content are placed in the HTML header and transmitted 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. You can use request to obtain parameters in either of the two methods.
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.
5. <form method = "get" Action = "A. asp? B = B "> with <form method =" get "Action =". ASP "> is the same. That is to say, the parameter list on the back of the Action page is ignored, while <forpolichod =" Post "Action =". asp? B = B "> unlike <form method =" Post "Action =" A. asp ">