Difference between request. querystring ("ID") and request ("ID ")

Source: Internet
Author: User

If you encounter a problem twice a day, copy it for your reference. Generally, the omnipotent request ("ID") is better.

The request reads data from several sets in order. The order from the beginning to the end is querystring, form, and servervariables. The request object searches for the variables in these sets in order of this order. If there is any matching variable, it will be aborted and the subsequent variables will be ignored.

Now let's analyze your problem.
Suppose there is a page named test. asp? Id = 111
Here, we use the get method for the page. request. querystring ("ID") is the same as request ("ID"). If you do not specify a set of requests, the querystring will be searched first.

If our page uses the POST method to send data to test. ASP, then request. querystring ("ID") is useless (he can only get), but must use request. from ("ID"), and if you still use request ("ID"), he can also obtain data, but first checks the value of querystring, it is obviously slow.

The following is an example of Detection:
<%
If request ("Submit") <> "then
response. write "directly:" & request ("username") & "
"
response. write "get:" & request. querystring ("username") & "
"
response. write "get post:" & request. form ("username ") & "
"
end if
%>




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.