QueryString not accepting & - Needs to
.net, asp.net, request.querystring, vb.net
Solution
`&` in your query string should be `%26`.
Since you can't correct the url.
You can read the refresh value as:
Request.QueryString("amp;Refresh");
Note that the developer of the service you are using may correct this in future. It would be good to be ready for that already.
var refresh = Request.QueryString("amp;Refresh");
if(String.IsNullOrEmpty(refresh))
refresh = Request.QueryString("Refresh");
Problem
I need to be able to handle an HTML encoded ampersand in my .Net code. So the Url is ``` http://myite.com/index.aspx?language=en&Refresh=true ``` There is no way of changing this as it has been generated by something else so this is out of my control. How can I read the Refresh parameter? I have tried ``` HttpUtility.UrlDecode(Request.QueryString("Refresh")) ``` but my Request.QueryString("Refresh") is actually empty, so this is pointless, as is Uri.EscapeDataString. This can't be the first time this has happened, but I'm struggling to find a solution, as most people would say use UrlEncoding, but as I said, the Url is out of my control.