|
 |
aspx_beginners thread: View State corrupted
Message #1 by "Dan McKinnon" <mddonna@q...> on Sun, 24 Feb 2002 04:28:53
|
|
Hi -
I am working my way through "Beginning ASP.NET using VB.NET". I was
especially interested in Microsoft's new take on form controls in Chapter
3. On page 126 there is a page named holidaypage.aspx that is a form page
that submits info to holidayresponse.aspx, which processes it. The problem
is that the textbox control that is runat = server must be contained in a
form that is also runat = server. I looked at the erratta for this book,
and sure enough, there was some workaround code submitted by Alessandro
Ansa. His solution was to nest another form with its runat attribute set
to server within the form that has an action attribute of another page and
no runat attribute set.
Apparently the default behavior of an aspx runat = server form is always
to submit its info to itself. In fact its beyond default, as when I set
the runat attribute to server and tried to put in an action attribute of a
second page (which is so very very common in .asp pages) it would not
accept it and changed the source code to submit it back to itself.
At any rate, I could not get even the supposedly good erratta code to
work. The first page displayed fine, but when the submit button is
clicked, it always gives me an error page saying the View_State of the
second page may be corrupted. I tried copying the code of both pages into
files with different names, restarting browser, IIS, rebooting computer,
etc. and I could not get the second page to display. It was always the
same message:
Server Error in '/' Application.
---------------------------------------------------------------------------
-----
The View State 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 View State is invalid for
this page and might be corrupted.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The View State is invalid for this page and
might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +150
System.Web.UI.Page.LoadPageViewState() +16
System.Web.UI.Page.ProcessRequestMain() +421
Any help is appreciated. As I go on in the book, one of the next exercises
in Chapter 4 builds on this example, so I would like to get some
resolution.
Thanks,
Dan
Message #2 by "Douglas J. Badin" <DJBadin@m...> on Mon, 25 Feb 2002 17:48:42 -0500
|
|
The short answer is to put the following line at the beginning of the
holidayresponse.aspx page.
<%@ Page EnableViewStateMac="false" %>
Doug
-----Original Message-----
From: Dan McKinnon [mailto:mddonna@q...]
Sent: Sunday, February 24, 2002 4:29 AM
To: aspx_beginners
Subject: [aspx_beginners] View State corrupted
Hi -
I am working my way through "Beginning ASP.NET using VB.NET". I was
especially interested in Microsoft's new take on form controls in
Chapter 3. On page 126 there is a page named holidaypage.aspx that is a
form page that submits info to holidayresponse.aspx, which processes it.
The problem is that the textbox control that is runat = server must be
contained in a form that is also runat = server. I looked at the erratta
for this book, and sure enough, there was some workaround code submitted
by Alessandro Ansa. His solution was to nest another form with its runat
attribute set to server within the form that has an action attribute of
another page and no runat attribute set. Apparently the default behavior
of an aspx runat = server form is always to submit its info to itself.
In fact its beyond default, as when I set the runat attribute to server
and tried to put in an action attribute of a second page (which is so
very very common in .asp pages) it would not accept it and changed the
source code to submit it back to itself.
At any rate, I could not get even the supposedly good erratta code to
work. The first page displayed fine, but when the submit button is
clicked, it always gives me an error page saying the View_State of the
second page may be corrupted. I tried copying the code of both pages
into files with different names, restarting browser, IIS, rebooting
computer, etc. and I could not get the second page to display. It was
always the same message:
Server Error in '/' Application.
------------------------------------------------------------------------
---
-----
The View State 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 View State is invalid
for this page and might be corrupted.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The View State is invalid for this page and
might be corrupted.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +150
System.Web.UI.Page.LoadPageViewState() +16
System.Web.UI.Page.ProcessRequestMain() +421
Any help is appreciated. As I go on in the book, one of the next
exercises in Chapter 4 builds on this example, so I would like to get
some resolution.
Thanks,
Dan
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
|
|
 |