Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Server.Transfer() causes an error

Thread Tools

Re: Server.Transfer() causes an error

Hans Kesting
Posts: n/a

"yma" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
> I put a .aspx page inside Server.Transfer() within a button. The page was
> created for testing so it only has button and I did not add code. When I
> click the button, it gave me an error below. Could try this and help me?
> Thank a lot. --Chris
> Server Error in '/mysite/WebApplication1' 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:

This is because all the Form fields are sent along with the Transfer,
the "__VIEWSTATE" hidden field which stores the (you guessed it) viewstate.

From MSDN:

public void Transfer(
string path,
bool preserveForm

If you set preserveForm to true and if the enableViewStateMac attribute of
the <pages> Element configuration element is true, ASP.NET will raise an
exception when Transfer is executed because the view state from the page
that calls Transfer is not valid on the destination page. One of the
preserved form fields on the calling page is the hidden __VIEWSTATE form
field, which holds the view state for the page. When enableViewStateMac is
true, ASP.NET runs a message authentication check (MAC) on the view state of
the destination page when the page is posted back from the client and the
check will fail. For security purposes, you should keep the
enableViewStateMac attribute set to true but there are other methods
available to transfer Forms data. For more information, including
recommended solutions, see article Q316920, "View State is Invalid Error
Message When You Use Server.Transfer" in the Microsoft Knowledge Base at Kesting

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error With Bound Control Causes redirection to 404 Error page instead of displaying error Bishop ASP .Net 1 02-24-2007 09:42 PM
Linksys adaptor causes system error =?Utf-8?B?TlZva2Vz?= Wireless Networking 1 10-03-2005 05:04 PM
RemoteOnly error mode causes error Paul Davies ASP .Net Web Services 1 03-29-2005 05:33 PM
Thunderbird Forwarded Mail Causes Fatal Error Gregg Firefox 0 02-19-2005 02:18 PM
Postback causes 100=Continue, causes double download prompt? Xavier Osa ASP .Net 0 01-09-2004 11:17 AM