CollapsiblePanelExtender 从客户端检测到潜在危险的 Request.Form 值

发布于 2024-11-18 10:37:06 字数 646 浏览 5 评论 0原文

每当单击按钮折叠/展开面板时,我都会遇到此错误。 错误: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>

I am encountering this error whenever the button is clicked to collapse/expand the panel.
Error: CollapsiblePanelExtender A potentially dangerous Request.Form value was detected from the client.

Can someone tell me what I did wrong and what is causing this?

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

递刀给你 2024-11-25 10:37:06

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

向 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 部分,则该部分将位于该部分内。

谢谢

Put validateRequest="false" in your page directive or web.config file.

Adding Cross-Site Scripting Protection to ASP.NET

for example if you already have:

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

then this should become:

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

Note:

If you are using .NET 4 then you will need to add requestValidationMode="2.0" to the httpRuntime configuration section of the web.config file. For example:

<httpRuntime requestValidationMode="2.0"/>

If you don't already have a httpRuntime section in the web.config file then this goes inside the section.

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文