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