Re: Server.Transfer() causes an error

Discussion in 'ASP .Net' started by Hans Kesting, Dec 8, 2003.

  1. Hans Kesting

    Hans Kesting Guest

    "yma" <> wrote in message
    news:%...
    > 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,
    including
    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
    http://support.microsoft.com.Hans Kesting
     
    Hans Kesting, Dec 8, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry III
    Replies:
    0
    Views:
    453
    Jerry III
    Oct 15, 2003
  2. Jeff Marken
    Replies:
    1
    Views:
    633
    Jerry III
    Oct 16, 2003
  3. Xavier Osa
    Replies:
    0
    Views:
    668
    Xavier Osa
    Jan 9, 2004
  4. Jesper Lund Stocholm

    Transfer thru WS-tier causes object property to be lost

    Jesper Lund Stocholm, Aug 7, 2008, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    105
    John Saunders
    Aug 7, 2008
  5. Jim
    Replies:
    1
    Views:
    995
    Aaron Bertrand - MVP
    Jan 28, 2004
Loading...

Share This Page