开发者

What's the point of HttpUtility.UrlDecode

开发者 https://www.devze.com 2023-01-20 20:25 出处:网络
What\'s the point of HttpUtility.UrlDecode when .net already decodes the querystring when you requ开发者_运维问答est it.

What's the point of HttpUtility.UrlDecode when .net already decodes the querystring when you requ开发者_运维问答est it.

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


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


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.)


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".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号