Can't access sending Web Forrm's ViewState

  • Thread starter Thread starter Dee
  • Start date Start date
D

Dee

Hi
I have added

EnableViewStateMac="false"

to the sending WebForm's @Page Directive and my sample code has the
following line:

Dim coll As System.Collections.Specialized.NameValueCollection
collForm = Request.Form
Dim n As Int16 = collForm.Count ' <-------- I get zero for this.

Why do I get an empty collection where the sending WebForm has many
server-side controls on it?

Thanks.
Dee
 
Actually when I attempt to go to the second page using:

Server.Transfer("result.aspx", True)

I get the following error message:

~~~~
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()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()
~~~~
 
Got it, had to include EnableViewStateMac="false" in both sending and
receiving codebehinds.


Dee said:
Actually when I attempt to go to the second page using:

Server.Transfer("result.aspx", True)

I get the following error message:

~~~~
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()
System.Web.UI.Page.LoadPageViewState()
System.Web.UI.Page.ProcessRequestMain()
~~~~


Dee said:
Hi
I have added

EnableViewStateMac="false"

to the sending WebForm's @Page Directive and my sample code has the
following line:

Dim coll As System.Collections.Specialized.NameValueCollection
collForm = Request.Form
Dim n As Int16 = collForm.Count ' <-------- I get zero for this.

Why do I get an empty collection where the sending WebForm has many
server-side controls on it?

Thanks.
Dee
 
Back
Top