Welcome to MSDN Blogs Sign in | Join | Help

SYSK 77: The Difference Between Microsoft.Security.Application.AntiXSSLibrary.HtmlEncode and System.Web.HttpUtility.HtmlEncode

As many of you may know, on Feb. 26 Microsoft has released Microsoft Application Security Anti-Cross Site Scripting Library.  The download is available at http://www.microsoft.com/downloads/details.aspx?familyid=9A2B9C92-7AD9-496C-9A89-AF08DE2E5982&displaylang=en.

 

The question is, since we already have HtmlEncode method under System.Web.HttpUtility to combat XSS, why do we need anything else?  As it turns out, HttpUtility.HtmlEncode only escapes the known dangerous characters/strings; the new AntiXSSLibrary.HtmlEncode (and UrlEncode) only allows a small subset of known safe strings and escapes everything else.  This is a much safer way to go!

 

P.S. If you would like to better understand the dangers of Cross Site Scripting, read this great paper -- HTML Code Injection and Cross-site scripting (http://www.technicalinfo.net/papers/CSS.html).
Published Tuesday, March 07, 2006 5:22 AM by irenak

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# DevShare.NET - Developers Sharing .NET Experience » MS Anti-Cross Site Scripting Library V1.0

# Cracking Open the Microsoft Anti Cross Site Scripting Library

Tuesday, March 07, 2006 4:08 PM by David Coe
Microsoft just released its first version of the Anti-Cross Site Scripting Library V1.0. 
Irena...

# re: SYSK 77: The Difference Between Microsoft.Security.Application.AntiXSSLibrary.HtmlEncode and System.Web.HttpUtility.HtmlEncode

Monday, January 22, 2007 2:07 PM by billys

Hello! I am Billy Johnson Nice design. Enjoy! Good site! OK. 0n79p7k .

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker