Reputation: 1492
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?
Upvotes: 21
Views: 30370
Reputation: 3273
In ASP MVC Core use this:
WebUtility.UrlDecode(string encodedValue)
Upvotes: 1
Reputation: 2251
Actually it should be HttpUtility.UrlDecode, not HttpServerUtility.
Upvotes: 49
Reputation: 308
An encoded url will automatically be decoded when passed into a controller action. For example:
public ActionResult Index(string url)
{
//url will be decoded here
}
Upvotes: -4