Validation of viewstate MAC failed.的解决方法

时间:2021-05-19

办法:页面的顶部page加EnableViewState="False"EnableViewStateMac="False"来解决这个问题
根据框架的提示如下:

ServerErrorin'/'Application.
--------------------------------------------------------------------------------

ValidationofviewstateMACfailed.IfthisapplicationishostedbyaWebFarmorcluster,ensurethat<machineKey>configurationspecifiesthesamevalidationKeyandvalidationalgorithm.AutoGeneratecannotbeusedinacluster.
Description:Anunhandledexceptionoccurredduringtheexecutionofthecurrentwebrequest.Pleasereviewthestacktraceformoreinformationabouttheerrorandwhereitoriginatedinthecode.

ExceptionDetails:System.Web.HttpException:ValidationofviewstateMACfailed.IfthisapplicationishostedbyaWebFarmorcluster,ensurethat<machineKey>configurationspecifiesthesamevalidationKeyandvalidationalgorithm.AutoGeneratecannotbeusedinacluster.

SourceError:


[Norelevantsourcelines]


SourceFile:h:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\TemporaryASP.NETFiles\root\df4db950\a034e6a\App_Web_o9fr0nmx.18.csLine:0

StackTrace:


[HttpException(0x80004005):Unabletovalidatedata.]
System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[]buf,Byte[]modifier,Int32start,Int32length,Int32&dataLength)+2546780
System.Web.UI.ObjectStateFormatter.Deserialize(StringinputString)+214

[ViewStateException:Invalidviewstate.
ClientIP:202.119.199.112
Port:1242
User-Agent:Mozilla/4.0(compatible;MSIE6.0;WindowsNT5.1;SV1;.NETCLR2.0.50727)
ViewState:/wEPDwUJNTM4MjQxOTkxZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAQUMSW1hZ2VCdXR0b24xjUihQtAeI0cDU56BxkYGL8w1G/4=
Referer:http://download.cumt.edu.cn/Admin/login.aspx
Path:/Admin/login.aspx]

[HttpException(0x80004005):ValidationofviewstateMACfailed.IfthisapplicationishostedbyaWebFarmorcluster,ensurethat<machineKey>configurationspecifiesthesamevalidationKeyandvalidationalgorithm.AutoGeneratecannotbeusedinacluster.]
System.Web.UI.ViewStateException.ThrowError(Exceptioninner,StringpersistedState,StringerrorPageMessage,BooleanmacValidationError)+116
System.Web.UI.ObjectStateFormatter.Deserialize(StringinputString)+251
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(StringserializedState)+4
System.Web.UI.Util.DeserializeWithAssert(IStateFormatterformatter,StringserializedState)+37
System.Web.UI.HiddenFieldPageStatePersister.Load()+220
System.Web.UI.Page.LoadPageStateFromPersistenceMedium()+83
System.Web.UI.Page.LoadAllState()+35
System.Web.UI.Page.ProcessRequestMain(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)+6953
System.Web.UI.Page.ProcessRequest(BooleanincludeStagesBeforeAsyncPoint,BooleanincludeStagesAfterAsyncPoint)+154
System.Web.UI.Page.ProcessRequest()+86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContextcontext)+18
System.Web.UI.Page.ProcessRequest(HttpContextcontext)+49
ASP.admin_login_aspx.ProcessRequest(HttpContextcontext)inh:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\TemporaryASP.NETFiles\root\df4db950\a034e6a\App_Web_o9fr0nmx.18.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+154
System.Web.HttpApplication.ExecuteStep(IExecutionStepstep,Boolean&completedSynchronously)+64

在使用了网上的EnableViewStateMac="false"后,
具体的问题就是保存不了session,修改了web.config里的配置还是一样的,后来还是没解决,只好还原了iis,

还是有问题,

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章