The difference between get and post methods in form submission

Source: Internet
Author: User
Tags html header alphanumeric characters

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 the parameter data
The queue is added to the URL that the Action property of the submission form refers to, and the value corresponds to each field in the form one by one, which is visible in the URL. Post is through the HttpPost mechanism, the forms within the
Fields and their contents in the HTML header are routed together 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: Get vs. post

HTTP Request: The difference between get and post methods
HTTP
defines the different ways to interact with the server, 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 the same
multiple requests for URLs should return the same results. 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 it doesn't change from its own point of view
Resources. 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 passed
The POST request is implemented because the site is different after the comment is submitted (for example, an annotation appears below the article);
when the form is submitted, if you do not specify method, the default
for a GET request, the data submitted in the form will be appended to the URL, separated from the URL. Alphanumeric characters are sent as-is, but the space is converted to "+", and other symbols are 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, while the data submitted by the post
In the Entity data;
The Get method submits only 1024 bytes of data, while Post does not have this limit.
What is the difference between using "post" and "get" in the form?
in the form, you can use post or get. They are all legal values of method. However, the post and get methods are at least two points different on use:
1. The Get method passes the user's input through a URL request. The Post method is in another form.
2, get mode of submission you need to use Request.QueryString to get the value of the variable, and when the post is submitted, you have to access the submitted content through Request.Form.
study the following code carefully. You can run it to feel:
Code
〈!– Two form only the method attribute is different –〉
〈form action= "getpost.asp" method= "get"?
〈input type= "text" name= "text" value= "Hello World" 〉〈/input〉
〈input type= "Submit" value= "Method=get" 〉〈/input〉
〈/form〉
〈br〉
〈form action= "getpost.asp" method= "POST"
〈input type= "text" name= "text" value= "Hello World" 〉〈/input〉
〈input type= "Submit" value= "Method=post" 〉〈/input〉
〈/form〉
〈br〉
〈br〉
〈% If request.querystring ("Text") 〈〉 "" Then%〉
The string passed by the Get method is: "〈b〉〈%= request.querystring (" Text ")%〉〈/b〉" 〈br〉
〈% End If%〉
〈% If request.form ("Text") 〈〉 "" Then%〉
The string passed through the Post method is: "〈b〉〈%= request.form (" Text ")%〉〈/b〉" 〈br〉
〈% End If%〉
Description
Save the above code as getpost.asp, then run, first test the Post method, at this time, the browser URL does not change anything, the result is returned:
The string passed through the Post method is: "Hello World"
then the test is submitted with the Get method, note that the URL of the browser becomes:
Http://localhost/general/form/getpost.asp?Text=Hello+World
The result of the return is:
The string passed by the Get method is: "Hello World"
Finally, through the Post method submission, the browser URL is:
Http://localhost/general/form/getpost.asp?Text=Hello+World
and the returned result becomes:
The string passed by the Get method is: "Hello World"
The string passed through the Post method is: "Hello World"
Tips
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.
Recommended
http://www.devdao.com/
The post method is recommended for use in form.
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.
very theoretical, but very standard, method= "get" is not to get data from the server, get and post just send mechanism is different, not one to take a hair!
The get method displays the value in the IE Address bar that indicates when you submitted it, and the Post method does not
1.
get is the URL where the parameter data queue is added to the Action property of the submission form, and the value corresponds to the field one by one in the form, which is visible in the URL. Post is through
The httppost mechanism, where each field within a form is placed inside the HTML header with its contents, to the URL address referred to by the Action property. The user does not see the process.
2, for Get mode, the server side uses Request.QueryString to get the value of the variable, for the Post method, the server side uses Request.Form to obtain the data submitted. The parameters of both methods can be obtained by using request.
3, get the amount of data transmitted less 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.
4, get security is very low, post security is high.
5.
〈form method= "Get" action= "a.asp?b=b" and 〈form
method= "Get" action= "a.asp" is the same, meaning that the list of arguments behind the action page is ignored;
〈formmethod= "POST" action= "A.asp?b=b" and 〈form
method= "POST" action= "a.asp" is not the same.
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 the URL address and the beginning of the data parameter, followed by a parameter each data parameter in the form of "name = value", the parameters and parameters are separated by a connector &.
The POST request has the following characteristics: The data is placed in the HTTP body, its organization is not only one, there is a & connection, there is a delimiter way, can hide parameters, transfer large numbers of data, more convenient.
The post Address bar does not appear a large list of things like Bjnghfgreygt .
if it's a get, it's going to happen.
1.
The get method passes the user's data through a URL request, connecting the field names in the form with their contents, in pairs of strings, to the program that the Action property refers to
URL, such as Http://www.mdm.com/test.asp?name=asd&passWord=sad, the data will be displayed directly in the
URL, just like a user clicking on a link, the Post method uses the HTTP post mechanism to place the names of fields within the form with their contents
HTML Header (header) is sent to the server side by
The Action property can be referred to by the program processing, the program through the standard input (stdin) way, the form of data read out and processed
2, get method need to use Request.QueryString to get the value of the variable, and post way through Request.Form to access the content of the submission
3.
The amount of data transferred in Get mode is very small, generally limited to about 2 KB, but the execution efficiency is better than the Post method;
Post is a relatively large amount of data passed, it is waiting for the server to read data, but there are byte restrictions, this is to avoid the server with a large amount of data for malicious attacks, according to Microsoft, the micro-
the maximum data that can be received by the soft pair with Request.Form () is limited, and IIS 4 is a KB byte, and IIS 5 is a KB byte
Recommendation: Unless you are sure that the data you submit can be submitted at once, please use the Post method as much as possible
4.
The get method commits the data, which poses a security issue, such as a landing page where the user name and password will appear when the data is submitted by a Get method .
on the URL, if the page can be cached or someone else can access the client's machine, the user's account number and password can be obtained from the history, so the form submission recommends using Post
The common problem with the form page 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 form
The Action property refers to the URL in which the value corresponds to each field in the form one by one, which is visible in the URL. Post is the httppost mechanism that places each field in the form with its contents
within the HTML header, it is routed to the URL address referred to by the Action property. The user does not see the process.
2, for Get mode, the server side uses Request.QueryString to get the value of the variable, for the Post method, the server side uses Request.Form to obtain the data submitted. The parameters of both methods can be obtained by using request.
3, get the amount of data transmitted less 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.
4, get security is very low, post security is high.
5.
〈form method= "Get" action= "a.asp?b=b" and 〈form
method= "Get" action= "a.asp" is the same, meaning that the list of arguments behind the action page is ignored;
〈formmethod= "POST" action= "A.asp?b=b" and 〈form
method= "POST" action= "a.asp" is not the same.

The difference between get and post methods in form submission

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.