URL Encode and Decode in ASP.NET Core

后端 未结 5 1897
花落未央
花落未央 2020-12-05 03:54
HttpContext.Current.Server.UrlEncode

It\'s only work in .NET Framework. How can I encode or decode uri arguments in ASP.NET Core project?

5条回答
  •  暖寄归人
    2020-12-05 04:13

    For ASP.Net Core 2.0+ and if you need spaces to be encoded as %20

    as opposed to +;

    Use:

     Uri.EscapeDataString(someString);
    

提交回复
热议问题