Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I decode a URL that was encoded with MVC's Url.Encode(string url)

Tags:

c#

asp.net-mvc

I'm surprised the UrlHelper provides an encoder but not a decoder! Does anyone have the code for decoding or know where to find it in the MVC framework?

like image 424
bradjive Avatar asked Feb 26 '10 15:02

bradjive


People also ask

What is URL encoded string?

URL Encoding (Percent Encoding) URL encoding converts characters into a format that can be transmitted over the Internet. URLs can only be sent over the Internet using the ASCII character-set. Since URLs often contain characters outside the ASCII set, the URL has to be converted into a valid ASCII format.

What is %2C in URL encoding?

The %2C means , comma in URL. when you add the String "abc,defg" in the url as parameter then that comma in the string which is abc , defg is changed to abc%2Cdefg . There is no need to worry about it.


2 Answers

HttpServerUtility.UrlDecode

like image 37
Yuriy Faktorovich Avatar answered Sep 25 '22 07:09

Yuriy Faktorovich


Actually it should be HttpUtility.UrlDecode, not HttpServerUtility.

like image 163
Donuts Avatar answered Sep 23 '22 07:09

Donuts