使用SharePoint 2010验证viewstate MAC失败

时间:2021-11-14 17:32:30

I'm getting stuck into this viewstate problem with my SharePoint 2010 application.

我在使用SharePoint 2010应用程序时遇到了这个viewstate问题。

Currently I created a custom master page which use my Custom Control named Navigation. The Navigation control HTML just contains 3 Hidden Fields in order to store data.

目前,我创建了一个自定义母版页,它使用名为Navigation的自定义控件。导航控件HTML只包含3个隐藏字段以存储数据。

When I apply the master page for my site, I created a List and then add a Three-State work flow to the list. After selecting Three-State workflow at the Add a Workflow screen (/_layouts/Addwrkfl.aspx), I click OK to submit.

当我为我的站点应用母版页时,我创建了一个列表,然后将三态工作流添加到列表中。在“添加工作流”屏幕(/_layouts/Addwrkfl.aspx)中选择“三态”工作流后,单击“确定”进行提交。

Then I got this error message

然后我收到此错误消息

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

验证视图状态MAC失败。如果此应用程序由Web场或群集托管,请确保配置指定相同的validationKey和验证算法。 AutoGenerate不能在群集中使用。

Stack Trace:

[ViewStateException: Invalid viewstate. 
    Client IP: 192.168.149.149
    Port: 56086
    User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
    ViewState: /wEWBAKi+o3/DAKVnOnXCwKa66m6DgKoxMKWBhUcn2XAshDSDMZdpDN35fWC8RHp
    Referer: `http://localhost/_layouts/Addwrkfl.aspx?List=%7B2897B53B%2D16AF%2D47A9%2DB963%2DC9501432C5CA%7D`
    Path: /_layouts/ItemRWfAssoc.aspx]
[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
   System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +148
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +10977361
   System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +205

*

I also removed all of the code behind of the Navigation control but the issue still appeared. It seems that the error appear before any C# code is executed.

我还删除了导航控件背后的所有代码,但问题仍然存在。似乎在执行任何C#代码之前出现错误。

If I tried to remove the 3 Hidden Field from the Navigation control, the issue went away.

如果我试图从导航控件中删除3隐藏字段,问题就消失了。

Any one could help me with this issue? Any ideas will be much appreciated.

任何人都可以帮我解决这个问题?任何想法将不胜感激。

Thanks in advance.

提前致谢。

FYI, I don't host my application using Web Farm

仅供参考,我不使用Web Farm托管我的应用程序

1 个解决方案

#1


0  

I received this error on my SP 2010 farm after I added some custom delegate control to run in master page. The control had server side text box, and some other html elements, when I switched the asp:textbox to html input the problem was gone

我添加了一些自定义委托控件以在母版页中运行后,我在SP 2010服务器场上收到此错误。控件有服务器端文本框和其他一些html元素,当我将asp:textbox切换为html输入时,问题就消失了

#1


0  

I received this error on my SP 2010 farm after I added some custom delegate control to run in master page. The control had server side text box, and some other html elements, when I switched the asp:textbox to html input the problem was gone

我添加了一些自定义委托控件以在母版页中运行后,我在SP 2010服务器场上收到此错误。控件有服务器端文本框和其他一些html元素,当我将asp:textbox切换为html输入时,问题就消失了