get and post the differences and scenarios

Original link: https://www.cnblogs.com/hmycheryl/p/8603365.html

the difference:

1. Different transfer methods: get transmitted through the address bar, post by packet transmission.

2.get generate a TCP packet, post generates two data packets. Get request mode, the browser will http header and data sent together, the server response 200; and for the browser to send post header, the server response 100 continue, the browser then transmits data, the server response 200.

3.get length limit parameters, the data transfer amount is not greater than 2kb, post unlimited amount of data transmission (usually by the server configuration, or restricted memory size).

4.get security is very low, post high security, but the efficiency is higher than the post.

5.get embodiment Resquest.QueryString server with a variable value acquisition, post way server-side data submitted by Request.Form acquired.

6.get data is acquired from the server, the server transmits data to a post.

Scenario:

If any of the following circumstances is met, the use get:

1. The request is to find resources, HTML form data is only used to help search.

2. Results There was no request for persistent side effects.

3. The total length of the data collection and input field names within the HTML form no more than 1024 characters.

If any of the following cases is met, a post:

Results 1. requests have persistent side effects, such as adding a new database in a database row.

2. If using the get method, the data collected on the form may make URL too long.

3. The data to be transmitted than using 7-bit ASCII code.

Guess you like

Origin www.cnblogs.com/ldddd/p/11206732.html