简体   繁体   English

从ASP.Net 1.1到ASP.Net 2.0的升级问题

[英]ASP.Net 1.1 to ASP.Net 2.0 upgrade issues

I am in the process of converting a large C# asp.net 1.1 project to asp.net 2.0. 我正在将一个大型C#asp.net 1.1项目转换为asp.net 2.0。 Everything works in asp.net 1.1, but not in asp.net 2.0. 一切都在asp.net 1.1中工作,但在asp.net 2.0中不工作。 I have managed to get everything to compile and for the most part everything works, but I have run across the following error: 我设法使所有内容都可以编译,并且大多数情况下一切正常,但是遇到了以下错误:

Invalid post or callback. <pages EventValidation="True"/> in configuration or <%@Page EnableEventValidation="true"%> in a page.  For security purposes, this feature verifies the arguments to post back or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use ClientScriptManager.Register for event validation method in order to register the postback or call back data for validation.

The situation is that I have one page launching another and the launched page attempts to post back to the original page. 情况是,我有一个页面正在启动另一个页面,并且已启动的页面试图回发到原始页面。 My confusion comes in when this worked in ASP.Net 1.1, but not in asp.net 2.0. 我的困惑出现在ASP.Net 1.1中,而在asp.net 2.0中却没有。 I have verified that "EventValidation" is found no where in the project or it's dependencies. 我已验证在项目中没有找到“ EventValidation”或其依赖项。 If I do have to use the ClientScriptManager.Register method does the call need to go into the parent page or the child page, and, where am I supposed to put this call? 如果必须使用ClientScriptManager.Register方法,则该调用是否需要进入父页面或子页面,并且应该将该调用放在哪里?

Any assistance that you can provide would be greatly appreciated. 您可以提供的任何帮助将不胜感激。

According to the documentation the default value for the EnableEventValidation property is true . 根据文档EnableEventValidation属性的默认值为true

If you wan't to disable it you should explicitly set the value to false . 如果您不想禁用它,则应将值显式设置为false This is not recommended though: 但是不建议这样做:

It is strongly recommended that you do not disable event validation. 强烈建议您不要禁用事件验证。 Before disabling event validation, you should be sure that no postback could be constructed that would have an unintended effect on your application. 在禁用事件验证之前,您应该确保不会构造会对应用程序产生意外影响的回发。

I recently had to upgrade a web application from .NET 1.1 to .NET 4.0 and I needed to add these tags to my web.config's <system.web> section: 我最近不得不将Web应用程序从.NET 1.1升级到.NET 4.0,我需要将这些标签添加到我的web.config的<system.web>部分:

<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" validateRequest="false"/>

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

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