Problem with 'Login/Log out button' and custom MVC Widget
I am running Sitefinity 6.0.4200.0 SE and am having trouble when I have a 'Login/Log out button' and a custom MVC widget on the same page.
Server Error in '/' Application.--------------------------------------------------------------------------------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. 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: 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.Source Error: [No relevant source lines] Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\64175248\4515be59\App_Web_59782c1a-51ae-69f1-bce4-ff0000a26cf3_130t083585490_basic.aspx.d63928b6.utw2q0l4.0.cs Line: 0 Stack Trace: [ViewStateException: Invalid viewstate. Client IP: ::1 Port: Referer: http://localhost:60876/ Path: /default.aspx User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0) ViewState: /wEPDwUKMTYxMjU1NjE5N2QYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgMFMEMwMDQkY3RsMDAkY3RsMDAkc2l0ZU1hcENvbnRyb2xfaG9yaXpvbnRhbHNpbXBsZQUjQzAwMyRjdGwwMCRjdGwwMCRyZW1lbWJlck1lQ2hlY2tib3gFH2N0bDE1JGN0bDAwJGN0bDAwJHdpbmRvd01hbmFnZXIHkDtaJYnZxJJozbOGHHUCfSbf7GDhCzqzLizgraxH7w==][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) +198 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +432 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose) +8 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +40 System.Web.UI.HiddenFieldPageStatePersister.Load() +248 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +88 System.Web.UI.Page.LoadAllState() +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245 System.Web.UI.Page.ProcessRequest() +72 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +58 System.Web.Mvc.OutputCacheAttribute.OnResultExecuting(ResultExecutingContext filterContext) +88 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +41 System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242 System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324 Telerik.Sitefinity.Mvc.ControllerWrapper.Execute() +133 Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy.ExecuteController() +4042 Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy.OnPreRender(EventArgs e) +45 System.Web.UI.Control.PreRenderRecursiveInternal() +83 System.Web.UI.Control.PreRenderRecursiveInternal() +168 System.Web.UI.Control.PreRenderRecursiveInternal() +168 System.Web.UI.Control.PreRenderRecursiveInternal() +168 System.Web.UI.Control.PreRenderRecursiveInternal() +168 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245 System.Web.UI.Page.ProcessRequest() +72 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +58 ASP.sfpageservice_59782c1a_51ae_69f1_bce4_ff0000a26cf3_130t083585490_basic_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\64175248\4515be59\App_Web_59782c1a-51ae-69f1-bce4-ff0000a26cf3_130t083585490_basic.aspx.d63928b6.utw2q0l4.0.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69 --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929I have contacted Telerik Support about this issue, and I have been provided with a solution that I wanted to share in case anyone else comes across the same issue.
Within my MVC > Controller > .CS file I had the following line:
OutputCache(NoStore = true, Duration = 0, VaryByParam = "*"),Thanks mikem (and Telerik Support).
I removed that line from my MVC > Controller > .CS file and it seems to have removed the error that I was getting.
Hello Mikem,
Thank you for sharing the solution with the community.