What is the difference between HttpUtility.HtmlEncode and Server.HtmlEncode

前端 未结 1 793

What is the difference between HttpUtility.HtmlEncode and Server.HTMLEncode?

相关标签:
1条回答
  • 2020-12-17 19:08

    Have a look at Server.HtmlEncode vs HttpUtility.HtmlEncode .

    Basically, Server.HtmlEncode uses a specific instance of the System.Web.HttpServerUtility class that's inherited from the Page class. HttpUtility.HtmlEncode is a static method, so you don't have to instantiate the HttpUtility class.

    All else being equal, go with the static HttpUtility.HtmlEncode.

    0 讨论(0)
提交回复
热议问题