ASP.NET EventValidation fails when .NET 4.5 Framework is installed in only one server behind the load balancer

[亡魂溺海] 提交于 2019-12-05 05:17:00

I had the same issue as we are currently migrating our server farm to Windows 2012 (.NET 4.5) from 2003 (.NET 4.0). Looking into the ClientScriptManager, the event validation code has changed considerably.

A fix for this was to add the appSetting to use Legacy Event Validation compatibility as described here

<appSettings>
  <add key="aspnet:UseLegacyEventValidationCompatibility" value="true" />
</appSettings>

Now the values generated for event validation in my pages are the same whether generated by .NET 4.0 or 4.5

Interesting problem, I would try to freeze some behaviors to a specific version of the Framework (in the web.config).

The Request Validation Mode

<httpRuntime requestValidationMode="4.0" />

The compilation target Framework

<compilation targetFramework="4.0">

The Control rendering compatibility version

<pages controlRenderingCompatibilityVersion="4.0"/>
Gadam

I'd check for the machine key configurations and make sure its the same on all servers. Uses for MachineKey in ASP.NET and http://aspnetresources.com/tools/machineKey

Also, you can check if you have any client side scripts

"If you write client script that changes a control in the client at run time, you might have to use the RegisterForEventValidation method in order to avoid false event validation errors."

http://msdn.microsoft.com/en-us/library/system.web.ui.page.enableeventvalidation.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!