HttpContext.Current.Server.UrlEncode
It\'s only work in .NET Framework. How can I encode or decode uri arguments in ASP.NET Core project?
For ASP.Net Core 2.0+ and if you need spaces to be encoded as %20
%20
as opposed to +;
+
Use:
Uri.EscapeDataString(someString);