decode querystring within context.Request

i have an ashx file that requires some query-string values to deliver appropriate images.

The problem is some search engines urlencode then htmlencode those urls in their cache or when they index those.

So for example instead of getting

/preview.ashx?file=abcd.jpg&root=small

i get

/preview.ashx?file=abcd.jpg&root=small

this basically throws off the context.Request.QueryString["root"] so it thinks that there's no variable root

i guess the second key in the querystring is amp;root i.e the part after the & sign.

What i'm wondering is if there's a way to automatically html and urldecode the querystring on serverside so that the program doesn't get confused.

Answers


There is no harm in calling HttpUtility.HtmlDecode or HttpUtility.UrlDecode more than once.

string queryString = "/preview.ashx?file=abcd.jpg&root=small";
var parsedString = HttpUtility.HtmlDecode(queryString);
var root = HttpUtility.ParseQueryString(parsedString)["root"];

Need Your Help

How to get field name dynamically in oracle pl/sql query?

sql oracle plsql oracle11g

I have a table that contains fields named 'value1','value2', 'value3'.

Oracle; two dates, difference in minutes

oracle date difference

I want to obtain the diffenece in minutes as integer between the sysdate and utcdate. this does not work:

Text superimposed in a textbox

python python-2.7 tkinter

I have several textboxes that I want to put in my program. For each of those, I'd like to have text that explains what to input. I've seen them on more complex non-Python programs.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.