Search code examples
c#html-sanitizingantixsslibrary

How to use C# to sanitize input on an html page?


Is there a library or acceptable method for sanitizing the input to an html page?

In this case I have a form with just a name, phone number, and email address.

Code must be C#.

For example:

"<script src='bobs.js'>John Doe</script>" should become "John Doe"


Solution

  • We are using the HtmlSanitizer .Net library, which:

    Also on NuGet