Question

What's the point of HttpUtility.UrlDecode when .net already decodes the querystring when you request it.

Is this a hangover from classic ASP or am I missing something?

Was it helpful?

Solution

It could be useful when you are getting content from another source which does not decode the data itself, as well. It is true that it is generally not needed, yes; but when it is needed, it's nice to have a Framework-level function that works as the complement to HttpUtility.UrlEncode

(as a side note; I may be remembering wrong, but I don't think I used UrlDecode much in classic ASP, either.)

OTHER TIPS

It is needed in case you received UrlEncoded data from other sources then querystring.

It can be used for a variety of things. Such as, the user submits a form where one of the fields contains a url to another website. Before displaying it you want to make sure it's decoded so that it displays "nicely".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top