Sometimes its the little bugs that really get to you. They are so small that you spend quite a lot of time figuring out what’s wrong and then it hits you.
In my case, the problem was simple. I had a parameter being passed to me on the URL.
The URL looked something like this:
param1 has a URL encoded value which translates into (without the double quotes):
Yeap, it has a “&” character as the value, but its URL encoded so it suppose to be OK.
When I went to get the value of param1 by using:
var string a = Request.QueryString[“param1”];
The value I got was:
No text3 for some reason.
It seems that in certain cases there is a bug. I suspect that it URL decodes the query string before it cuts it up and fill in the Request.QueryString collection.
I didn’t fill like going through all the massive amounts of code of HttpRequest and friends using Reflector, so I just wrote a function that handles the URL decode and splitting issues correctly.
If you wish, I can post it as a link here.