The difference between post and get request methods

Source: Internet
Author: User
Tags html header http post iis

The string passed through the Post method is: "〈b〉〈%= request.form (" Text ")%〉〈/b〉" 〈br〉


〈% End If%〉


Description


to save the above code as getpost.asp, and then run, first test the Post method, this time, the browser URL does not change, the result returned is:

The string that
passes through the Post method is: "Hello World"


then the test is submitted with the Get method, notice that the URL of the browser becomes:


Http://localhost/general/form/getpost.asp?Text=Hello+World


and the result returned is:

The string that
passes through the Get method is: "Hello World"


finally submitted through the Post method, the browser URL or:


Http://localhost/general/form/getpost.asp?Text=Hello+World

The result returned by
:

The string that
passes through the Get method is: "Hello World"

The string that
passes through the Post method is: "Hello World"


hint


submitting data through a GET method can pose a security issue. Like a landing page. When data is submitted through the Get method, the username and password appear on the URL. if:


1, landing page can be cached by the browser;


2, other people can access the customer's machine.


then, someone else can read the account number and password from the browser's history. Therefore, in some cases, the Get method poses a serious security problem.


suggested


http://www.devdao.com/


In the form, it is recommended that you use the Post method.

The difference between
get and post is 2


get: The information that is given to the resource specified by the request URI as an entity, and if the request URI is merely a data generation process, the final return in the response entity is the resource pointed to by the result of the processing, rather than the description of the process.


post: Used to make a request to the destination server that it accept the entity appended to the request and treat it as an additional subkey for the resource specified by the request URI in the request queue, which is designed to implement the following functionality in a uniform way:


1: Interpretation of existing resources


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


3: Submit data Block


4: Extend the database with additional operations


as you can see from the above, get is a request to send data to the server, and post is a request to submit data to the server, the data to be submitted is in the entity behind the message header.




The
get method will display the value in the IE Address bar that indicates when you submitted it; The Post method does not


1, get is to add the parameter data queue to the submission of the form's action attribute in the URL, the value and the form of each field one by one corresponding, in the URL can be seen. Post is the httppost mechanism by which each field in the form is placed with its contents in the HTML header and routed to the URL address referred to by the action attribute. This process is not visible to the user.


2, for Get way, the server end uses Request.QueryString to obtain the variable value, for post way, server end uses Request.Form to obtain the submitted data. The parameters of both methods can be obtained by request.


3, get transmitted data volume is small, can not be greater than 2KB. Post transfers have a large amount of data, which is generally default to unrestricted. In theory, however, the maximum number of IIS4 is 100KB in 80KB,IIS5.


4, get security is very low, post security is high.


5, 〈form method= "get" action= "A.asp?b=b" is the same as 〈form method= "got" action= "a.asp", which means that the list of parameters behind the action page is ignored; Formmethod= "POST" action= "A.asp?b=b" is not the same as 〈form method= "POST" action= "a.asp".


In addition, a GET request has the following characteristics: It adds data to the URL, which is passed to the server in this way, usually using a question mark? Represents the end of a URL address and the beginning of a data parameter, with each data parameter in the form of a "name = value", which is differentiated between parameters and parameters using a connector &.


Post requests have the following characteristics: The data is placed in the HTTP body, the organization of more than one, there are & connection, there are split way, can be hidden parameters, transfer a large number of data, more convenient.


Post Address bar does not appear a large string? Bjnghfgreygt such a thing


if it is get, there will be a


1, the Get method passes the user's data through a URL request, connects each field name in the form with its contents, and puts it into a pair of strings, placed after the URL of the program that the action attribute refers to, such as HTTP://WWW.MDM.COM/TEST.ASP?NAME=ASD &password=sad, the data will be displayed directly on the URL, just like the user clicks on a link; The Post method passes the field names in the form to the server side with the content in the HTML header (header) through the HTTP post mechanism. The action attribute can be handled by the program referred to in the standard input (stdin) mode, which reads and processes the data of the form


2, get mode needs to use Request.QueryString to obtain the value of the variable, and the Post method through the Request.Form to access the content submitted


3. The amount of data transmitted by get is very small, the general limit is about 2 KB, but the execution efficiency is better than the Post method, and the post is a relatively large amount of data, it is waiting for the server to read data, but also have byte limit, this is to avoid the server with a large amount of data for malicious attacks, According to Microsoft, Microsoft has a limit on the maximum number of data that can be received with Request.Form (), which is kb bytes in IIS 4 and KB bytes in IIS 5


: Unless you are sure that the data you submitted can be submitted at once, please use the Post method as much as possible


4, get way to submit data, can bring security problems, such as a landing page, the user name and password will appear on the URL when the data is submitted via get, and if the page can be cached or someone else can access the machine, the user's account and password can be obtained from the history record. So the form submission suggests using the Post method; The common problem with form pages submitted by the Post method is that if the page is refreshed, a dialog box pops up


1, get is to add the parameter data queue to the submission of the form's action attribute in the URL, the value and the form of each field one by one corresponding, in the URL can be seen. Post is the httppost mechanism by which each field in the form is placed with its contents in the HTML header and routed to the URL address referred to by the action attribute. This process is not visible to the user.


2, for Get way, the server end uses Request.QueryString to obtain the variable value, for post way, server end uses Request.Form to obtain the submitted data. The parameters of both methods can be obtained by request.


3, get transmitted data volume is small, can not be greater than 2KB. Post transfers have a large amount of data, which is generally default to unrestricted. In theory, however, the maximum number of IIS4 is 100KB in 80KB,IIS5.


4, get security is very low, post security is high.


5. The 〈form method= "get" action= "A.asp?b=b" is the same as 〈form method= "got" action= "a.asp", which means that the list of parameters behind the action page is ignored; Formmethod= "POST" action= "A.asp?b=b" is not the same as 〈form method= "POST" action= "a.asp".

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.