Http Method: difference between Get request and Post request

Source: Internet
Author: User
Tags html header

Reprinted from http://blog.csdn.net/xutingzhou/article/details/8168370

Get is a request to request data from the server, while Post is a request to submit data to the server;

 

 

Get is used to obtain information, rather than modify information. Similar to the database query function, data is not modified;

 

 

The Get request parameters are transmitted after the url, and the request data is attached to the URL? Splits the URL and transmits data. The parameters are connected to each other. XX in % XX represents the ASCII code in hexadecimal notation. If the data is an English letter or number, it is sent as is, if it is a space, convert it to +. If it is a Chinese character or other character, the string is encrypted using base64.

 

 

The size of data transmitted by Get is limited. Because GET submits data through a URL, the amount of data that can be submitted by GET is directly related to the URL length, different browsers have different restrictions on the URL length.

The GET request data will be cached by the browser, and the user name and password will appear in the URL in plain text. Others can check the historical browsing records, which is not safe. On the server side, Request. QueryString is used to obtain the data submitted in Get mode;

 

 

THE Post request is sent to the web server as the actual content of the http message, and the data is placed in the HTML Header for submission. There is no limit on the submitted data for Post. Post is safer than Get. when the data is Chinese or non-sensitive data, use get. Because get is used, the parameters are displayed at the address. for sensitive data and data that is not Chinese characters, post is used;

 

 String name = Context. Request. QueryString ["name"]

POST indicates a Request that may modify resources on the server. on the server side, data submitted in Post mode can only be obtained using Request. Form.

String name = context. Request. Form ["pwd"];

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.