•  ebdrup
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
verything is fine, configs are fine, and working nice, But all comes a sudden, it results redirection loop in this URL


I get this erro, just loading the default.aspx page, and now the transaction log for the database is full.

This is the error in the event log:

System.Web.HttpException: 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: Invalid viewstate.
Client IP:
Port: 1435
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MRA 4.3 (build 0121; .NET CLR 1.1.4322)
Path: /default.aspx ---> System.Web.HttpException: Unable to validate data.
at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)
at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)
at System.Web.UI.HiddenFieldPageStatePersister.Load()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

But as far as I can see there is nothing written to the event log when the error occurs. I tried looking at the event log, and then caused the error and looked at the event log again, seems nothing was written.

I tried editing default.aspx to not have the
<YAF:Forum runat="server" ID="forum"></YAF:Forum>

The redirect problem persists even when the forum is removed from default.aspx.
So the error must be in some kind of processor or handle
Do you run you app inside a webfarm or just a single server?

If it is a single server there are couple of workarounds for this issue:

1=add the following string inside system.web tag in web.config

<pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />

This has a side effect if security is important because requests are not validated.

2=add you own machinekey to the web.config so there will be no conflict.You can create valid machine keys through this website: Machinekey Generator 

this  also may help.

  •  ebdrup
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
I have already tried what you suggest, it didn't help. But as I write I don't think the error in the log is the error causing the infinite redirection loop. Nothing seems to be written to the log when the error occurs.
And even if i remove the forum tag entirely from default.aspx, the problem persists.
Also the error occurs the first time I enter the forum and load default.aspx, that could never cause the error in the log, that has to be a submit of a page generated by the forum.

The error must be somewhere in a httphandler or something like that, as far as I can see.
I have an identical issue with our forum

Single server, and the forum is DOA until this is fixed, I tried the updating the system.web / pages but that halted the entire web site. I have no idea how to add a machine key.

BTW: Preview at this YAF.net site appears to be broken.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved