WebUtility.HtmlDecode replacement in .NET Core

后端 未结 6 547
故里飘歌
故里飘歌 2020-12-09 00:39

I need to decode HTML characters in .NET Core (MVC6). It looks like .NET Core doesn\'t have WebUtility.HtmlDecode function which everybody used for that purpose before. Is t

6条回答
  •  伪装坚强ぢ
    2020-12-09 01:03

    This is in the System.Net.WebUtility class (Since .NET Standard 1.0) :

    //
    // Summary:
    //     Provides methods for encoding and decoding URLs when processing Web requests.
    public static class WebUtility
    {
        public static string HtmlDecode(string value);
        public static string HtmlEncode(string value);
        public static string UrlDecode(string encodedValue);
        public static byte[] UrlDecodeToBytes(byte[] encodedValue, int offset, int count);
        public static string UrlEncode(string value);
        public static byte[] UrlEncodeToBytes(byte[] value, int offset, int count);
    }
    

提交回复
热议问题