AjaxControlToolkit.Tests.HtmlSanititzer.DefaultHtmlsanitizerSanitizerTests.ImageNullBreaksUpXSSTest1 C# (CSharp) Method

ImageNullBreaksUpXSSTest1() private method

private ImageNullBreaksUpXSSTest1 ( ) : void
return void
        public void ImageNullBreaksUpXSSTest1()
        {
            // Arrange
            DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
            Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();

            // Act
            string htmlFragment = "perl -e 'print \"<IMG SRC=java\0script:alert(\"XSS\")>\";' > out";
            string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);

            // Assert
            string expected = "perl -e 'print \"<img src=\"java&#xfffd;:alert(&quot;XSS&quot;)\">\";' > out";
            StringAssert.AreEqualIgnoringCase(expected, actual);
        }
DefaultHtmlsanitizerSanitizerTests