Dec
5
HttpException (0x80004005): Unable to validate data
I found this on a website and it fixed the problem:
HttpException :: Unable to validate data
If you are receiving HttpExceptions in your ASP.NET applications on postbacks; saying, Unable to validate data, you may try setting enableViewStateMac to false. You can do so at page level or for entire site in web.config.
But, Microsoft's MSDN says not to use it, now I'm torn....
This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
http://msdn.microsoft.com/library/d...ateMacTopic.asp
Why shouldn't someone use this code?
And Error Message after clicking on the submit button.
问题就是出在,iis将生成的viewstate数据加密,加密算法有好几种,缺省是iis自己选择的一种,它也会为这个加密自动生成一个密钥.当你postbacks页面的时候,iis用自动生成的密钥无法验证你postbacks回来的数据,这样就会产生错误了. 这个问题,比较容易在使用了负载均衡的几台服务器之间出现 .
解决方法很简单:
在web.config, system.web中, 加入machineKey配置,指定你自己的密钥或者算法。
最简单的方法就是前面的把enableViewStateMac 设为 false.
HttpException :: Unable to validate data
If you are receiving HttpExceptions in your ASP.NET applications on postbacks; saying, Unable to validate data, you may try setting enableViewStateMac to false. You can do so at page level or for entire site in web.config.
<configuration>
<system.web>
<pages enableViewStateMac="false" />
</system.web>
</configuration>
<system.web>
<pages enableViewStateMac="false" />
</system.web>
</configuration>
But, Microsoft's MSDN says not to use it, now I'm torn....
This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
http://msdn.microsoft.com/library/d...ateMacTopic.asp
Why shouldn't someone use this code?
And Error Message after clicking on the submit button.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Unable to validate data.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Unable to validate data.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60
[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102
[HttpException (0x80004005): Invalid_Viewstate
Client IP: 68.132.73.25
Port: 3184
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
ViewState: dDwyMTA4MDAzNDk4OztsPGNrUGVyc2lzdDs+PgBgwwf8rg7x3lLaAsn+X8hoWAMA
Http-Referer:
Path: /login.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
--------------------------------------------------------------------------------
Unable to validate data.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Unable to validate data.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +196
System.Web.UI.LosFormatter.Deserialize(String input) +60
[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +118
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102
[HttpException (0x80004005): Invalid_Viewstate
Client IP: 68.132.73.25
Port: 3184
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
ViewState: dDwyMTA4MDAzNDk4OztsPGNrUGVyc2lzdDs+PgBgwwf8rg7x3lLaAsn+X8hoWAMA
Http-Referer:
Path: /login.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +443
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
问题就是出在,iis将生成的viewstate数据加密,加密算法有好几种,缺省是iis自己选择的一种,它也会为这个加密自动生成一个密钥.当你postbacks页面的时候,iis用自动生成的密钥无法验证你postbacks回来的数据,这样就会产生错误了. 这个问题,比较容易在使用了负载均衡的几台服务器之间出现 .
解决方法很简单:
在web.config, system.web中, 加入machineKey配置,指定你自己的密钥或者算法。
最简单的方法就是前面的把enableViewStateMac 设为 false.
Adding .flv
Linux的用户和组群管


