简体   繁体   English

无法使用参数禁用asp.net页的验证请求

[英]Not able to disable the validation request for asp.net page with parameters

I am using the tinyMCE rich text editor in gridview in my page. 我在页面的gridview中使用tinyMCE富文本编辑器。 When I am changing the gridview to edit mode, I'm getting the error "Invalid postback or callback argument. Event validation is enabled". 当我将gridview更改为编辑模式时,出现错误“无效的回发或回调参数。已启用事件验证”。 To over come this error, I have added the below code in my web.config file. 为了克服此错误,我在web.config文件中添加了以下代码。

Now richtext is working fine for mypage.aspx page. 现在,richtext对于mypage.aspx页工作正常。 But my problem is that I am passing some parameters into this page and reloading this page like "mypage.aspx?tp=all". 但是我的问题是我要向该页面传递一些参数,然后像“ mypage.aspx?tp = all”一样重新加载该页面。 In that case I'm getting the same error. 在这种情况下,我会遇到相同的错误。 Is there any way I can add below code to work with all parameters. 有什么办法可以添加以下代码来使用所有参数?

I have tried as below but loading it self failing. 我尝试了如下,但加载失败。

      <location path="mypage.aspx?tp=all">  tried

    <location path="mypage.aspx">
     <system.web>
      <httpRuntime requestValidationMode="2.0" />
      <pages validateRequest="false" />
    </system.web>
    </location>

尝试使用@Page指令将其直接添加到mypage.aspx

<%@ Page validateRequest="false" %> 

I have added my following line to make it work. 我添加了以下代码以使其正常运行。

        if (!Page.IsPostBack)
          {
             //added all page load code here
          }

and in web config added this: 并在网络配置中添加了以下内容:

    <location path="mypage.aspx">
       <system.web>
         <httpRuntime requestValidationMode="2.0" />
         <pages validateRequest="false" />
       </system.web>
    </location>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM