ASP.Net 1.1 to ASP.Net 2.0 upgrade issues

313 views Asked by At

I am in the process of converting a large C# asp.net 1.1 project to asp.net 2.0. Everything works in asp.net 1.1, but not in 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. I have verified that "EventValidation" is found no where in the project or it's dependencies. 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?

Any assistance that you can provide would be greatly appreciated.

2

There are 2 answers

0
juan.facorro On

According to the documentation the default value for the EnableEventValidation property is true.

If you wan't to disable it you should explicitly set the value to 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.

0
Cameron Tinker On

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:

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