Post and get Analysis

Source: Internet
Author: User

In form, you can use post or get. They are all valid values of method, but they are also different. The main difference is that the methods for passing and obtaining the number of measures are different.

1. Get method: 1. Transfer Method of number of workers:
User input is transmitted through URL requests. In the address bar, we can see the number of tokens passed by the submission. This is also the default number of tokens passed by the browser.
2. Get the number of passed partitions:
You must use request. querystring to obtain the value of the variable for get-based submission.
3. length limit of the number of passed tokens
The length of the number of bytes transmitted in get mode is limited to 2 kb.
Instance:

Pass a few pages to get.html



Submitted page: server.html




Ii. Post method: 1. Transfer Method of number of workers:
The number of post parts is URL encoded. However, the variable name/variable value is not transmitted as part of the URL, but is transmitted within the actual HTTP request message.
2. Get the number of passed partitions:
When submitting a POST request, you must use request. Form to submit the submitted content.
3. length limit of the number of passed tokens
The amount of data transmitted by post is large and is generally considered unrestricted.

Instance:

Front-end form:

  <form id="fm" method="post" novalidate runat="server">   <input type="hidden" id="test" name="test" />  </form>


Background processing program

提交到后台一般处理程序        public void ProcessRequest(HttpContext context)        {            //调试            if (null != context.Request.Form["id"])            {//获取前台传来的值               string category = context.Request.Form["test"].ToString().Trim();            }            string command =context.Request.Form["test"].ToString().Trim();//前台传的标示值                      {//调用查询方法                Query(context);            }        }



Iii. Summary:



Post and get Analysis

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.