Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the difference between AntiXss.HtmlEncode and HttpUtility.HtmlEncode?
    primarykey
    data
    text
    <p>I just ran across a question with an answer suggesting the AntiXss library to avoid cross site scripting. Sounded interesting, reading the <a href="http://msdn.microsoft.com/en-us/library/aa973813.aspx" rel="noreferrer">msdn blog</a>, it appears to just provide an HtmlEncode() method. But I already use HttpUtility.HtmlEncode().</p> <p><strong>Why would I want to use AntiXss.HtmlEncode over HttpUtility.HtmlEncode?</strong></p> <p>Indeed, I am not the first to ask this question. And, indeed, Google turns up <a href="http://blogs.msdn.com/dansellers/archive/2006/02/23/538187.aspx" rel="noreferrer">some</a> <a href="http://blogs.msdn.com/securitytools/archive/2009/07/09/differences-between-antixss-htmlencode-and-httputility-htmlencode-methods.aspx" rel="noreferrer">answers</a>, mainly</p> <ul> <li>A white-list instead of black-list approach</li> <li>A 0.1ms performance improvement</li> </ul> <p>Well, that's nice, but what does it mean for me? I don't care so much about the performance of 0.1ms and I don't really feel like downloading and adding another library dependency for functionality that I already have.</p> <p><strong>Are there examples of cases where the AntiXss implementation would prevent an attack that the HttpUtility implementation would not?</strong></p> <p>If I continue to use the HttpUtility implementation, am I at risk? What about <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=252514" rel="noreferrer">this 'bug'</a>?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload