Feb 15, 2014, 1:32 PM
Viewstate error when using asp.net form 4.5 template forms authentication
using the asp.net 4.5 template from VS 2013 with forms authentication.
The standard template works fine. But when I insert this code in the asp.net file Site.Master
Page.ViewStateUserKey = _antiXsrfTokenValue; "from the template code behind in site.master in method page_init
and it will fail with
The standard template works fine. But when I insert this code in the asp.net file Site.Master
<asp:ContentPlaceHolder runat="server" ID="HeaderContent"/>
</head>
<body>
<form runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" > </ext:ResourceManager>
<asp:ScriptManager runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--Framework Scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
when try logging in or logout. This will set the property Page.ViewStateUserKey = _antiXsrfTokenValue; "from the template code behind in site.master in method page_init
and it will fail with
Server Error in '/' Application.
--------------------------------------------------------------------------------
The state information is invalid for this page and might be corrupted.
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: The state information is invalid for this page and might be corrupted.
Source Error:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\73ff2d36\2103949\App_Web_kfycqcv3.3.cs Line: 0
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: inputString]
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +9871443
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() +127
[ViewStateException: Invalid viewstate.
Client IP: ::1
Port: 20080
Referer: http://localhost:10260/Account/Login
Path: /Account/Login
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)
ViewState: ]
[HttpException (0x80004005): The state
I have tried the different combinations on the Ext:ResourceManager like DisableViewState="true" EnableViewState="false" . I believe the Ext is not supposed to tamper with the viewstate, so this error makes no sense ?
Last edited by geoffrey.mcgill; Feb 15, 2014 at 1:47 PM.
Reason: Please use [CODE] tags