Search code examples
asp.net-web-apiself-hostingurldecode

How to UrlDecode without having System.Web dll in c#


I'm about to create a self-hosted Web API application, and somewhere I need to URL Decode the input. But I truly don't want to add a reference to System.Web.dll, because AMAIK, it's a heavy DLL and one of the main reasons of getting far from ASP.NET and IIS.

If I'm right, and I don't add a reference to System.Web, then how can I URL Decode effectively without bugs?


Solution

  • //.Net 4.0+

    you can use WebUtility.UrlDecode(). It is not part of system.web.

    And you can see this blog: Html and Uri String Encoding without System.Web