【问题标题】:CollapsiblePanelExtender A potentially dangerous Request.Form value was detected from the clientCollapsiblePanelExtender 从客户端检测到具有潜在危险的 Request.Form 值
【发布时间】:2011-07-06 14:31:46
【问题描述】:

每当单击按钮折叠/展开面板时,我都会遇到此错误。 错误:CollapsiblePanelExtender 从客户端检测到具有潜在危险的 Request.Form 值。

谁能告诉我我做错了什么以及是什么原因造成的?

<asp:Button ID="Button1" runat="server" Text="Button" />
 <ajaxToolkit:CollapsiblePanelExtender 
    TargetControlID="testPanel" 
    ID="CollapsiblePanelExtender1" 
    runat="server"
    ExpandControlid="Button1"
    CollapseControlID="Button1" 
    Collapsed="False" 
    ExpandDirection="Vertical" 
    AutoCollapse="false" 
    AutoExpand="false">

</ajaxToolkit:CollapsiblePanelExtender>

<asp:Panel ID="testPanel" runat="server">
    stuff here
</asp:Panel>

【问题讨论】:

    标签: asp.net ajaxcontroltoolkit


    【解决方案1】:

    validateRequest="false" 放入您的页面指令或 web.config 文件中。

    Adding Cross-Site Scripting Protection to ASP.NET

    例如,如果您已经拥有:

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb"  Inherits="Proj.MyForm"%>
    

    那么这应该变成:

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="MyForm.aspx.vb" Inherits="Proj.MyForm" ValidateRequest="false"%>
    

    注意:

    如果您使用的是 .NET 4,则需要将 requestValidationMode="2.0" 添加到 web.config 文件的 httpRuntime 配置部分。例如:

    <httpRuntime requestValidationMode="2.0"/>
    

    如果您在 web.config 文件中还没有 httpRuntime 部分,则该部分位于该部分中。

    谢谢

    【讨论】:

    • 感谢它的工作,但 validateRequest="false" 究竟是做什么的?
    猜你喜欢
    • 2011-02-26
    • 2010-12-20
    • 2012-05-29
    相关资源
    最近更新 更多