Filed: .NET Developer Tools
There is an update to the Microsoft Anti-Cross Site Scripting Library that was released the other day. We are now up to version 3.1 and the new library includes two new methods to help you santitize your input of malicious scripts before outputting the results to the browser:
- GetSafeHtml
- GetSafeHtmlFragment
I was confused as to the difference of the two methods so I gave them a spin.
When you use GetSafeHtml it will add any missing tags, like the html and body tags around the contents if it is missing. GetSafeHtmlFragment will just sanitize the input and display the results as html and not add any missing tags.
Pretty useful.
You can download it here.
David Hayden
ASP.NET Web Security Tutorials