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

时间:2013-06-19 19:50:23

标签: c# upgrade asp.net-2.0 asp.net-1.1

我正在将一个大型的C#asp.net 1.1项目转换为asp.net 2.0。一切都在asp.net 1.1中运行,但不在asp.net 2.0中。我已经成功地编译了所有内容,并且大部分内容都能正常运行,但我遇到了以下错误:

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.

情况是我有一个页面启动另一个页面,并且启动的页面尝试回发到原始页面。当这在ASP.Net 1.1中有效时,我的困惑就出现了,但在asp.net 2.0中没有。我已经验证了&#34; EventValidation&#34;找不到项目中的位置或它的依赖项。如果我必须使用ClientScriptManager.Register方法,那么调用需要进入父页面还是子页面,我应该在哪里进行此调用?

非常感谢您提供的任何帮助。

2 个答案:

答案 0 :(得分:0)

根据documentationEnableEventValidation属性的默认值为true

如果您不想禁用它,则应将值明确设置为false。不建议这样做:

  

强烈建议您不要禁用事件验证。   在禁用事件验证之前,您应该确保没有回发   可以构造,会对你的意外产生影响   应用

答案 1 :(得分:0)

我最近不得不将Web应用程序从.NET 1.1升级到.NET 4.0,我需要将这些标记添加到我的web.config的<system.web>部分:

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