Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your question really sparked my interest, so I've done some reading for the past hour or so. I'm not absolutely positive I've found the answer, but I'll throw it out there to see what you think.</p> <p>From what I've read so far, Request.QueryString is actually "a parsed version of the QUERY_STRING variable in the ServerVariables collection" <a href="http://msdn.microsoft.com/en-us/library/ms524784.aspx" rel="nofollow noreferrer"> [reference] </a>, where as Request.Url is (as you stated) the raw URL encapsulated in the Uri object. According to <a href="http://msdn.microsoft.com/en-us/library/aa332621(VS.71).aspx" rel="nofollow noreferrer">this article</a>, the Uri class' constructor "...parses the [url string], puts it in canonical format, and makes any required escape encodings." </p> <p>Therefore, it appears that Request.QueryString uses a different function to parse the "QUERY_STRING" variable from the ServerVariables constructor. This would explain why you see the difference between the two. Now, why different encoding methods are used by the custom parsing function and the Uri object's parsing function is entirely beyond me. Maybe somebody a bit more versed on the aspnet_isapi DLL could provide some answers with that question.</p> <p>Anyway, hopefully my post makes sense. On a side note, I'd like to add another reference which also provided for some very thorough and interesting reading: <a href="http://download.microsoft.com/download/6/c/a/6ca715c5-2095-4eec-a56f-a5ee904a1387/Ch-12_HTTP_Request_Context.pdf" rel="nofollow noreferrer">http://download.microsoft.com/download/6/c/a/6ca715c5-2095-4eec-a56f-a5ee904a1387/Ch-12_HTTP_Request_Context.pdf</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload