URL Encode and Decode in ASP.NET Core
It's available on version 2.0.0 of the .Net Core SDK, in System.Net.WebUtility.UrlEncode
(see documentation)
For ASP.NET Core 2.0+ just add
System.Net
namespace -WebUtility
class is shipped as part ofSystem.Runtime.Extensions
nuget package, that is referenced by default in ASP.NET Core project.For the previous version add
Microsoft.AspNetCore.WebUtilities
nuget package.
Then the WebUtility
class will be available for you:
public static class WebUtility
{
public static string UrlDecode(string encodedValue);
public static string UrlEncode(string value);
}