Server.HtmlEncode vs HttpUtility.HtmlEncode
2011-11-07 11:09
429 查看
Server.HtmlEncodeis equivalent to
System.Web.HttpContext.Current.Server.HtmlEncode. The ServerObject is an instance of the
System.Web.HttpServerUtilityclass and it is readily accessible through any .aspx page since they inherit from the
Pageobject which in turn has a
ServerObject instance.
The
HttpUtility.HtmlEncodefunction lives under
System.Web.HttpUtility. This class is basically a
staticversion of the
Serverclass which means that you could call the
HtmlEncodefunction from a
staticfunction or call from another class that does not have an instance of the
HttpServerUtilityclass.
There is a third
HtmlEncodefunction located in the Microsoft’s AntiCross-Site Scripting Library. In contrast with the
Server.HtmlEncodeand
HttpUtility.HtmlEncodefunctions, the later function takes a more aggressive approach by using a white-list filtering instead of a black-list,hence more PCI standards-compliant, and more secure.
HttpServerUtility.HtmlEncodewill use
HttpUtility.HtmlEncodeinternally. There is no specific difference. The reason for existence of
Server.HtmlEncodeis compatibility with classic ASP.
相关文章推荐
- Server对象 HttpUtility.UrlDecode |UrlEncode |HtmlEncode
- HttpServerUtility Server.HtmlEncode与Server.HtmlDecode
- javascript; JS版HtmlEncode方法,结果与C#中HttpUtility.HtmlEncode方法一样。
- System.Web.HttpUtility VS System.Web.HttpServerUtility VS System.Net.WebUtility
- javascript; JS版HtmlEncode方法,结果与C#中HttpUtility.HtmlEncode方法一样。
- POST数据提交,关于System.Web.HttpUtility.HtmlEncode与System.Web.HttpUtility.UrlEncode的区别
- HttpUtility.Encode与Server.Encode
- javascript中文编码/解析与C#ASP.NET中文编码/解析 C#: Server.UrlEncode() HttpUtility.UrlEncode() javascript: escape() encodeURI() encodeURICom
- HttpUtility.HtmlEncode
- HttpUtility.HtmlEncode(防止用户强行注入JavaScript语句)
- 关于 HttpUtility.UrlEncode 和 HttpUtility.HtmlEncode 的区别
- HttpUtility.HtmlEncode 方法 (String)
- javascript中文编码/解析与C#ASP.NET中文编码/解析 C#: Server.UrlEncode() HttpUtility.UrlEncode() javascript: escape() encodeURI() encod
- HttpUtility.HtmlEncode 方法
- Server.UrlEncode 与 HttpUtility.UrlEncode
- Server.UrlEncode、HttpUtility.UrlDecode的区别
- .NET/ASP.NET/C#/WCF/SQL Server/My SQL/Java/JSP/JDBC/Spring/Spring MVC/PHP/Python/Ruby/Shell/Agile/CSS/HTML/HTTP/Unix/Linux大量PDF书籍/电子书籍下载, Effective Java 下载
- HttpUtility.UrlEncode,Server.UrlEncode
- solrj使用报错:HttpSolrServer$RemoteSolrException: Expected mime type application/xml but got text/html
- (转)关于HttpUtility.UrlEncode,HttpUtility.UrlDecode,Server.UrlEncode,Server.UrlDecode