本文整理汇总了C#中AjaxControlToolkit.HtmlEditor.Sanitizer.DefaultHtmlSanitizer类的典型用法代码示例。如果您正苦于以下问题:C# DefaultHtmlSanitizer类的具体用法?C# DefaultHtmlSanitizer怎么用?C# DefaultHtmlSanitizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultHtmlSanitizer类属于AjaxControlToolkit.HtmlEditor.Sanitizer命名空间,在下文中一共展示了DefaultHtmlSanitizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MakeSureItSanitized
public void MakeSureItSanitized(string htmlFragment, string message)
{
var target = new DefaultHtmlSanitizer();
var elementWhiteList = CreateElementWhiteList();
var actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
if(htmlFragment != "See Below")
StringAssert.AreNotEqualIgnoringCase(htmlFragment, actual, message);
}
开发者ID:CharlieBP,项目名称:AjaxControlToolkit,代码行数:10,代码来源:HaCkerOrgXMLTest.cs
示例2: AnchorTagContentReplaceXSSTest
public void AnchorTagContentReplaceXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.gohttp://www.google.com/ogle.com/\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<A HREF=\"http://www.gohttp://www.google.com/ogle.com/\">XSS</A>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:CharlieBP,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例3: AnchorTagDownlevelHiddenBlockXSSTest
public void AnchorTagDownlevelHiddenBlockXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.codeplex.com?url=<!--[if gte IE 4]><SCRIPT>alert('XSS');</SCRIPT><![endif]-->\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"http://www.codeplex.com?url=<!--[if gte IE 4]><>alert('XSS');</><![endif]-->\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例4: AnchorTagDownlevelHiddenBlockXSSTest
public void AnchorTagDownlevelHiddenBlockXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.codeplex.com?url=<!--[if gte IE 4]><SCRIPT>alert('XSS');</SCRIPT><![endif]-->\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<A HREF=\"http://www.codeplex.com?url=&lt;!--[if gte IE 4]&gt;&lt;&gt;alert(&#39;XSS&#39;);&lt;/&gt;&lt;![endif]--&gt;\">XSS</A>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:CharlieBP,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例5: AnchorTagDwordEncodingXSSTest
public void AnchorTagDwordEncodingXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://1113982867/\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"http://1113982867/\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例6: DivExpressionXSSTest
public void DivExpressionXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<DIV STYLE=\"width: expression(alert('XSS'));\">";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<div style=\"width:(alert('XSS'));\"></div>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例7: DivBackgroundImageXSSTest
public void DivBackgroundImageXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<DIV STYLE=\"background-image: url(javascript:alert('XSS'))\">";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<div style=\"background-image: url(\"></div>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例8: DivStyleExpressionHtmlQuotesEncapsulation1XSSTest
public void DivStyleExpressionHtmlQuotesEncapsulation1XSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<Div style=\"background-color: expression(<SCRIPT a=\">\" SRC=\"http://ha.ckers.org/xss.js\"></SCRIPT>)\">";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<div style=\"background-color:(<a=\">\" SRC=\"http://ha.ckers.org/xss.js\">)\"></div>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例9: XmlWithEmbeddedScriptXSSTest
public void XmlWithEmbeddedScriptXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<XML SRC=\"xsstest.xml\" ID=I></XML><SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML></SPAN>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<SPAN></SPAN>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例10: AnchorTagJavascriptLinkLocationXSSTest
public void AnchorTagJavascriptLinkLocationXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"javascript:document.location='http://www.google.com/'\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<A HREF=\"\">XSS</A>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例11: DivStyleExpressionDownlevelHiddenBlockXSSTest
public void DivStyleExpressionDownlevelHiddenBlockXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<Div style=\"background-color: expression(<!--[if gte IE 4]><SCRIPT>alert('XSS');</SCRIPT><![endif]-->)\">";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<div style=\"background-color:(<!--[if gte IE 4]><>alert('XSS');</><![endif]-->)\"></div>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例12: AnchorTagStyleExpressionXSSTest
public void AnchorTagStyleExpressionXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "exp/*<A STYLE='no\\xss:noxss(\"*//*\");xss:ex/*XSS*//*/*/pression(alert(\"XSS\"))'>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "exp/*<a></a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例13: AnchorTagExtraneousOpenBracketsXSSTest
public void AnchorTagExtraneousOpenBracketsXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.codeplex.com?url=<<SCRIPT>alert(\"XSS\");//<</SCRIPT>\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"http://www.codeplex.com?url=<<>alert(\"></a>\">XSS";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例14: AnchorTagProtocolResolutionScriptXSSTest
public void AnchorTagProtocolResolutionScriptXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.codeplex.com?url=<SCRIPT SRC=//ha.ckers.org/.j>\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"http://www.codeplex.com?url=<SRC=//ha.ckers.org/.j>\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例15: AnchorTagProtocolResolutionXSSTest
public void AnchorTagProtocolResolutionXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"//www.google.com/\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"//www.google.com/\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例16: AnchorTagNoQuotesXSSTest
public void AnchorTagNoQuotesXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.codeplex.com?url=<SCRIPT>a=/XSS/alert(a.source)</SCRIPT>\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"http://www.codeplex.com?url=<>a=/XSS/alert(a.source)</>\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例17: AnchorTagNonAlphaNonDigitXSSTest
public void AnchorTagNonAlphaNonDigitXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<A HREF=\"http://www.codeplex.com?url=<SCRIPT/XSS SRC=\"http://ha.ckers.org/xss.js\"></SCRIPT>\">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"http://www.codeplex.com?url=</XSS SRC=\">\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例18: AnchorTagMixedEncodingXSSTest
public void AnchorTagMixedEncodingXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = @"<A HREF=""h
tt p://6	6.000146.0x7.147/"">XSS</A>";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<a href=\"h\r\ntt\tp://6&#9;6.000146.0x7.147/\">XSS</a>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:15,代码来源:DefaultHtmlSanitizerTests.cs
示例19: DivHtmlQuotesEncapsulation7XSSTest
public void DivHtmlQuotesEncapsulation7XSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<Div style=\"background-color: http://www.codeplex.com?url=<SCRIPT>document.write(\"<SCRI\");</SCRIPT>PT SRC=\"http://ha.ckers.org/xss.js\"></SCRIPT>\">";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<div style=\"background-color: http://www.codeplex.com?url=<>document.write(\"></div>PT SRC=\"http://ha.ckers.org/xss.js\">\">";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
示例20: DivNoQuotesXSSTest
public void DivNoQuotesXSSTest()
{
// Arrange
DefaultHtmlSanitizer target = new DefaultHtmlSanitizer();
Dictionary<string, string[]> elementWhiteList = CreateElementWhiteList();
// Act
string htmlFragment = "<Div style=\"background-color: http://www.codeplex.com?url=<SCRIPT>a=/XSS/alert(a.source)</SCRIPT>\">";
string actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);
// Assert
string expected = "<div style=\"background-color: http://www.codeplex.com?url=<>a=/XSS/alert(a.source)</>\"></div>";
StringAssert.AreEqualIgnoringCase(expected, actual);
}
开发者ID:DevExpress,项目名称:AjaxControlToolkit,代码行数:14,代码来源:DefaultHtmlSanitizerTests.cs
注:本文中的AjaxControlToolkit.HtmlEditor.Sanitizer.DefaultHtmlSanitizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论