The difference between get and post in HTTP request mode

Source: Internet
Author: User
Tags html header

There are 5 differences between get and post methods in form submission.

1.get is the data that is fetched from the server, and post is the data sent to the server.

2.get is to add the parameter data queue to the URL that the Action property of the submission form refers to, and the value corresponds to the field one by one in the form, which can be seen in the URL. Post is the httppost mechanism by which the fields within the form are placed within the HTML header with their contents and routed to the URL address referred to by the Action property. The user does not see the process.

3. For Get mode, the server side uses Request.QueryString to get the value of the variable, and for post, the server side uses Request.Form to obtain the submitted data.

4.get transmits a small amount of data and cannot be greater than 2KB. Post transmits a large amount of data, which is generally not restricted by default. In theory, however, the maximum amount of IIS4 is 100KB in 80KB,IIS5. (There are other articles here that describe the transfer data size of Get and post for each browser, operating system, and server restrictions)

5.get security is very low and post security is high.

There are 5 differences between get and post methods in form submission.

1.get is the data that is fetched from the server, and post is the data sent to the server.

2.get is to add the parameter data queue to the URL that the Action property of the submission form refers to, and the value corresponds to the field one by one in the form, which can be seen in the URL. Post is the httppost mechanism by which the fields within the form are placed within the HTML header with their contents and routed to the URL address referred to by the Action property. The user does not see the process.

3. For Get mode, the server side uses Request.QueryString to get the value of the variable, and for post, the server side uses Request.Form to obtain the submitted data.

4.get transmits a small amount of data and cannot be greater than 2KB. Post transmits a large amount of data, which is generally not restricted by default. In theory, however, the maximum amount of IIS4 is 100KB in 80KB,IIS5.

5.get security is very low and post security is high.

HTTP request: The difference between get and post methods

HTTP defines different ways to interact with the server, and the most basic method is get and post. In fact get applies to most requests, while retaining post is only used to update the site. According to the HTTP specification, get is used for information acquisition and should be secure and idempotent. The so-called security means that the operation is used to obtain information rather than modify information. In other words, get requests generally should not have side effects. Idempotent means that multiple requests to the same URL should return the same result. The complete definition is not as strict as it seems. Fundamentally, the goal is that when a user opens a link, she can be confident that the resource has not changed from its point of view. For example, the front page of news sites is constantly being updated. Although the second request returns a different batch of news, the operation is still considered safe and idempotent, as it always returns the current news. Vice versa. The POST request is not that easy. Post represents a request that might change resources on the server. Still take the news site as an example, the reader's comments on the article should be implemented through a POST request, because the site is different after the comment is submitted (for example, a note appears below the article);

When the form is submitted, if you do not specify method, the default is a GET request, and the data submitted in the form will be appended to the URL, separated from the URL. The alphanumeric character is sent as is, but the space is converted to the "+" sign, and the other symbol is converted to%XX, where XX is the ASCII (or ISOLatin-1) value of the symbol in 16 binary notation. The GET request submits the data to be placed in the HTTP request protocol header, and the data submitted by the post is placed in the Entity data;

The following is a code demonstration:

View Code

Run the first form form and the results are as follows

The parameters in the form are submitted to the URL specified by the action, and the values correspond to each field in the form one by one, which can be seen in the URL. The space number is converted to the plus sign, and the Chinese in the Submit button is translated in order to%+ the ASCII (or ISOLatin-1) value in 16 binary notation. After the form is submitted to the server, the results of the user's specified parameters in the form are returned.

The results after running the post form are as follows:

The server does not return the results for the submission parameters in the user form, but the fields within the form are routed to the URL address that the Action property refers to, along with the content being placed inside the HTML header, which the user cannot see in the Address bar.

Submitting data through the Get method can pose a security issue. such as a landing page. When data is submitted through the Get method, the user name and password appear on the URL. If:

1, the landing page can be cached by the browser;

2, other people can access the customer's machine. Then someone can read the account number and password from the browser's history. Therefore, in some cases, the Get method poses a serious security problem.

The difference between get and post 2

Get: Is the information of the resource specified by the request URI as an entity, and if the request URI is only a data generation process, the final return in the response entity is the resource to which the result of the processing is directed, rather than the description of the processing process.

Post: Used to make a request to the destination server that accepts the entity attached to the request and treats it as an additional new subkey for the resource specified by the request URI in the request queue, and post is designed to implement the following functions in a uniform way:

1: Interpretation of existing resources

2: Send messages to bulletin boards, newsgroups, mailing lists, or similar discussion groups.

3: Commit data block

4: Extending the database with additional operations

As can be seen from the description above, get is a request to send data to the server, while post is a request to submit data to the server, the data to be submitted is in the entity behind the information header.

The difference between get and post in HTTP request mode

Related Article

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.