Note that there are some explanatory texts on larger screens.

plurals
  1. POC# ASP.NET HttpWebRequest automatically decodes ampersand (&) values from query string?
    primarykey
    data
    text
    <p>Assume the following Url:</p> <pre><code>"http://server/application1/TestFile.aspx?Library=Testing&amp;Filename=Documents &amp; Functions + Properties.docx&amp;Save=true" </code></pre> <p>I use HttpUtility.UrlEncode() to encode the value of the Filename parameter and I create the following Url:</p> <pre><code>"http://server/application1/TestFile.aspx?Library=Testing&amp;Filename=Documents%20%26%20Functions%20%2B%20Properties.docx&amp;Save=true" </code></pre> <p>I send the following (encoded version) of request from a client to a C# Web Application. On the server when I process the request I have a problem. The HttpRequest variable contains the query string partially decoded. That is to say when I try to use or quick watch the following properties of HttpRequest they have the following values.</p> <pre><code>Property = Value ================ HttpRequest.QueryString = "{Library=Testing&amp;Filename=Documents+&amp;+Functions+++Properties.docx&amp;Save=true}" HttpRequest.Url = "{http://server/application1/TestFile.aspx?Library=Testing&amp;Filename=Documents &amp; Functions + Properties.docx&amp;Save=true}" HttpRequest.Url.AbsoluteUri = "http://server/application1/TestFile.aspx?Library=Testing&amp;Filename=Documents%20&amp;%20Functions%20+%20Properties.docx&amp;Save=true" </code></pre> <p>I have also checked the following properties but all of them have the &amp; value decoded. However all other values remain properly encoded (e.g. space is %20).</p> <pre><code>HttpRequest.Url.OriginalString HttpRequest.Url.Query HttpRequest.Url.PathAndQuery HttpRequest.RawUrl </code></pre> <p>There is no way I can read the value of the parameter Filename properly. Am I missing something?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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