Problem with porting 1.1 code to 2.0

Problem with porting 1.1 code to 2.0

am 05.01.2006 21:08:03 von Keep

Does anyone know how to fix this problem? On form submittal I'm getting the
following error in Visual Studio 2005:

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\v2.0.50727\Temporary ASP.NET
Files\safr\118004fd\203f0603\App_Web_sv3-fnpn.48.cs Line: 0

Stack Trace:


[FormatException: Invalid character in a Base-64 string.]
System.Convert.FromBase64String(String s) +0
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +134

System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateForma tter.Deserialize(String serializedState) +30
System.Web.UI.ClientScriptManager.EnsureEventValidationField Loaded() +212

[ViewStateException: Invalid viewstate.
Client IP: 127.0.0.1
Port:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727)
ViewState:
/wEWAgKOg/LRDgKN4NHjBij4PKMgzQWEZZkIk8JSlKYY7EC/,/wEWDAKCxZ+ jDQKkpuXGBwL69am5BgLh797wDAK1sI/HCgLvjO4YAo3g0eMGAsyw8osKAvW VzI0KAorJ7tsBAq7EpukBAvbp+p0Djowsg+f3etZ7ubdiJW0xlk3WE2Y=
Referer: http://localhost:2732/SAFR/SystemForm.aspx?SystemID=7135
Path: /SAFR/SystemForm.aspx]

[HttpException (0x80004005): The state information is invalid for this page
and might be corrupted.]
System.Web.UI.ViewStateException.ThrowError(Exception inner, String
persistedState, String errorPageMessage, Boolean macValidationError) +171
System.Web.UI.ViewStateException.ThrowViewStateError(Excepti on inner,
String persistedState) +37
System.Web.UI.ClientScriptManager.EnsureEventValidationField Loaded() +249
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String
argument) +202
System.Web.UI.Control.ValidateEvent(String uniqueID, String
eventArgument) +83
System.Web.UI.Control.ValidateEvent(String uniqueID) +35
System.Web.UI.HtmlControls.HtmlInputText.LoadPostData(String postDataKey,
NameValueCollection postCollection) +101

System.Web.UI.HtmlControls.HtmlInputText.System.Web.UI.IPost BackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +36
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean
fBeforeLoad) +478
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5915
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +188
System.Web.UI.Page.ProcessRequest() +112
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +37
System.Web.UI.Page.ProcessRequest(HttpContext context) +135
ASP.systemform_aspx.ProcessRequest(HttpContext context) in
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
Files\safr\118004fd\203f0603\App_Web_sv3-fnpn.48.cs:0

System.Web.CallHandlerExecutionStep.System.Web.HttpApplicati on.IExecutionStep.Execute() +401
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +117




------------------------------------------------------------ --------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42

--
Bill Larson

RE: Problem with porting 1.1 code to 2.0

am 06.01.2006 08:06:43 von stcheng

Hi Bill,

Welcome to ASPNET newsgroup.
From your description, after upgrated to asp.net 2.0, one of your asp.net
page will always throw some validation exception when running, yes?

Does the exception always occur only when you postback the page? Also, from
the page's aspx and codebehind, can you find any particular changes in it?
Based on my experience, since ASP.NET 2.0 use "EnableEventValidation" by
default, so if you page programmatically output some clientside script for
post back or write out some html form elememt, there'll raise such
validation exception when post back.... You can try turn off the
"EnableEventvalidation" in @Page directive to see whether it helps...

@ Page
http://msdn2.microsoft.com/en-us/library/ydy4x04a.aspx

If there're anything else you found, please feel free to post here also.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Thread-Topic: Problem with porting 1.1 code to 2.0
| thread-index: AcYSM7wrazKd2jVTRZe9E3QqJawXfA==
| X-WBNR-Posting-Host: 158.15.255.228
| From: "=?Utf-8?B?QmlsbA==?="
| Subject: Problem with porting 1.1 code to 2.0
| Date: Thu, 5 Jan 2006 12:08:03 -0800
| Lines: 82
| Message-ID: <2FDC3C6C-F684-46EE-94DD-F1E91D046940@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:368852
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Does anyone know how to fix this problem? On form submittal I'm getting
the
| following error in Visual Studio 2005:
|
| 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\v2.0.50727\Temporary
ASP.NET
| Files\safr\118004fd\203f0603\App_Web_sv3-fnpn.48.cs Line: 0
|
| Stack Trace:
|
|
| [FormatException: Invalid character in a Base-64 string.]
| System.Convert.FromBase64String(String s) +0
| System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +134
|
|
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateForma tter.Deserialize
(String serializedState) +30
| System.Web.UI.ClientScriptManager.EnsureEventValidationField Loaded()
+212
|
| [ViewStateException: Invalid viewstate.
| Client IP: 127.0.0.1
| Port:
| User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET
| CLR 1.1.4322; .NET CLR 2.0.50727)
| ViewState:
|
/wEWAgKOg/LRDgKN4NHjBij4PKMgzQWEZZkIk8JSlKYY7EC/,/wEWDAKCxZ+ jDQKkpuXGBwL69am
5BgLh797wDAK1sI/HCgLvjO4YAo3g0eMGAsyw8osKAvWVzI0KAorJ7tsBAq7 EpukBAvbp+p0Djow
sg+f3etZ7ubdiJW0xlk3WE2Y=
| Referer: http://localhost:2732/SAFR/SystemForm.aspx?SystemID=7135
| Path: /SAFR/SystemForm.aspx]
|
| [HttpException (0x80004005): The state information is invalid for this
page
| and might be corrupted.]
| System.Web.UI.ViewStateException.ThrowError(Exception inner, String
| persistedState, String errorPageMessage, Boolean macValidationError) +171
| System.Web.UI.ViewStateException.ThrowViewStateError(Excepti on inner,
| String persistedState) +37
| System.Web.UI.ClientScriptManager.EnsureEventValidationField Loaded()
+249
| System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId,
String
| argument) +202
| System.Web.UI.Control.ValidateEvent(String uniqueID, String
| eventArgument) +83
| System.Web.UI.Control.ValidateEvent(String uniqueID) +35
| System.Web.UI.HtmlControls.HtmlInputText.LoadPostData(String
postDataKey,
| NameValueCollection postCollection) +101
|
|
System.Web.UI.HtmlControls.HtmlInputText.System.Web.UI.IPost BackDataHandler.
LoadPostData(String postDataKey, NameValueCollection postCollection) +36
| System.Web.UI.Page.ProcessPostData(NameValueCollection postData,
Boolean
| fBeforeLoad) +478
| System.Web.UI.Page.ProcessRequestMain(Boolean
| includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5915
| System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint,
| Boolean includeStagesAfterAsyncPoint) +188
| System.Web.UI.Page.ProcessRequest() +112
| System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +37
| System.Web.UI.Page.ProcessRequest(HttpContext context) +135
| ASP.systemform_aspx.ProcessRequest(HttpContext context) in
| c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET
| Files\safr\118004fd\203f0603\App_Web_sv3-fnpn.48.cs:0
|
|
System.Web.CallHandlerExecutionStep.System.Web.HttpApplicati on.IExecutionSte
p.Execute() +401
| System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
| completedSynchronously) +117
|
|
|
|
------------------------------------------------------------ ----------------
----
| Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET
| Version:2.0.50727.42
|
| --
| Bill Larson
|