Detailed explanation of get and post

     Get and post are the two basic ways to submit data in a form. The get request data is transmitted through the domain name suffix url, which is visible to the user and is insecure. The post request data is transmitted in the body of the request message, which is relatively safe.

get is to pass the form value through the url, and the post cannot see the value of the form field through the url;

The amount of data transmitted by get is limited. If you want to transmit a large amount of data, you cannot use get, such as type="file" to upload an article, type="password" to transmit a password, or < text area > to send   Get and post are two forms of form submission data. This is a basic method. The get request data is transmitted through the domain name suffix url, which is visible to the user and is not safe. The post request data is transmitted in the body of the request message, which is relatively safe.

get is to pass the form value through the url, and the post cannot see the value of the form field through the url;

The amount of data passed by get is limited. If you want to pass a large amount of data, you cannot use get, such as uploading an article with type="file", passing a password with type="password", or publishing a large article in < text area >, but post does not have this limitation. ;

Post will prompt the browser to resubmit the form, but get will not (answer with extra points)

For the Post form, if you re-knock the address bar and refresh it, you will not be prompted to resubmit, because if you re-knock the address, there will be no secretly submitted data. The correct address of the Post method is difficult to send directly to others.

Difference between GET and POST

1. The data submitted by GET will be placed after the URL. The URL and transmission data are separated by ?, and the parameters are connected by &, such as EditPosts.aspx?name=test1&id=123456. The POST method is to put the submitted data in the HTTP package in the body.

2. The size of the data submitted by GET is limited (because the browser has a limit on the length of the URL), while the data submitted by the POST method is not limited.

3. The GET method needs to use Request.QueryString to get the value of the variable, and the POST method uses Request.Form to get the value of the variable.

4. Submitting data by GET method will bring security problems, such as a login page. When submitting data by GET method, the username and password will appear on the URL. If the page can be cached or other people can access the machine, they can Get the user's account and password from the history.

GET is to get data from the server, POST is to send data to the server.

GET is to add the parameter data queue to the URL pointed to by the ACTION attribute of the submitted form. The value corresponds to each field in the form, which can be seen in the URL. POST is through the HTTP POST mechanism, each field in the form and its content are placed in the HTML HEADER and sent to the URL address pointed to by the ACTION attribute. The user cannot see this process.

For the GET method, the server uses Request.QueryString to obtain the value of the variable, and for the POST method, the server uses Request.Form to obtain the submitted data

The amount of data transferred by GET is small and cannot be larger than 2KB (this is mainly due to the limitation of URL length). The amount of data sent by POST is large and is generally defaulted to unlimited. But in theory, the limit depends on the processing power of the server.

GET is less secure, POST is more secure. Because GET is in the transmission process, the data is placed in the requested URL, and many existing servers, proxy servers or user agents will record the request URL in a log file and then put it somewhere, so there may be Some private information is seen by third parties. In addition, the user can also directly see the submitted data on the browser, and some internal system messages will be displayed in front of the user together. All POST operations are invisible to the user.

Link: https://www.jianshu.com/p/d7e9a23eb703

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325735142&siteId=291194637