Answers for "C# sanitize html string"

C#
0

SanitizeHtml c#

public void ImageXSS2Test()
        {
            // Arrange
            var sanitizer = new HtmlSanitizer();


            // Act
            string htmlFragment = "<IMG SRC=javascript:alert('XSS')>";
            string actual = sanitizer.Sanitize(htmlFragment);

            // Assert
            string expected = "<IMG>";
            Assert.That(actual, Is.EqualTo(expected).IgnoreCase);
        }
Posted by: Guest on August-17-2020

C# Answers by Framework

Browse Popular Code Answers by Language