Can some tell me the exact difference between Request.Form
and Request.QueryString
?
I know one difference, like
If the HTTP request method is POST, the user submitted data is in the Request.Form() collection
If the HTTP request method is GET, then user submitted data is in the Request.QueryString() collection
any other difference? and Any example would be greatly appreciated.
Request.Form Collection
Request.QueryString Collection
For example, if the following request is sent:
for more details click this link
Request.Form - means you are wanting to retrieve the values for the form that was posted.
Request.QueryString - means you are wanting to retrieve values that have been passed on the querystring.
In
Request.Form
the data is posted inhttp
header whereas inQueryString
data is sent through url.Request.Form()
Request.QueryString()
As stated on MSDN,
So, some things to note:
In a typical Form on a page, we may include some hidden elements:
Hidden elements (if memory serves), are not displayed in the
QueryString
. So, I would assume that there are some things that are not shown inRequest.QueryString
. Unfortunately I am in the process of re-installing dev apps on a new machine and cannot test this at the moment but if I'm right, when youPOST
a form, more details about the form and its contents gets sent. And when you accessQueryString
, you are only seeing the things that make up the entirety of the URL, e.g.:http://somesite.com/index.html?v=1&NonHiddenElement=lol&ManualValue=hello
I found some other difference
will first try to locate
then
then
and finally
and we can refer this link for more some details :
http://www.hanselman.com/blog/ASPNETParamsCollectionVsQueryStringFormsVsRequestindexAndDoubleDecoding.aspx
But any one know any other difference, I really appreciate that .