I have recently started using Request("key") instead of Request.QueryString("key") to access my querystring values. However I have read that:
Gets the specified object from the System.Web.HttpRequest.Cookies,
System.Web.HttpRequest.Form, System.Web.HttpRequest.QueryString,
System.Web.HttpRequest.ServerVariables
Therefore, if I have a querystring key and cookie key which are the same, which value is returned?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
They’re checked in the following order:
QueryStringFormCookiesServerVariables
The search is short-circuited, so as soon as a matching key is found the value is returned.
So, to answer your question, a matching QueryString item takes precedence over Cookies.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0