WebUtility.HtmlDecode replacement in .NET Core

后端 未结 6 540
故里飘歌
故里飘歌 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:04

    This is in Net Core 2.0

    using System.Text.Encodings.Web;
    

    and call it:

    $"Please confirm your account by clicking here.");
    

    UPDATE: Also in .Net Core 2.1:

    using System.Web;
    
    HttpUtility.UrlEncode(code)
    HttpUtility.UrlDecode(code)
    

提交回复
热议问题