Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Web Pages
Learning More
 How to: Determine How ASP.NET Web P...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
ASP.NET 
How to: Determine How ASP.NET Web Pages Were Invoked 

It is often useful to know how an ASP.NET Web page was invoked: whether by an original request (an HTTP GET), a postback (an HTTP POST), a cross-page post from another page (an HTTP POST), or a transfer from another page using the Transfer method or using a callback from the browser. The Page class exposes a set of properties that you can use to determine how a page was invoked.

To determine how an ASP.NET Web page was invoked

  • Examine the values of the following Page class properties, and then refer the table to determine how the page was invoked:

    The following table lists ways in which a page can be invoked and the corresponding Page property values.

    Invocation method Property values

    Original request

    • IsPostBack is set to false.

    • PreviousPage is set to null (Nothing in Visual Basic).

    • IsCallback is set to false.

    Postback

    • IsPostBack is set to true.

    • PreviousPage is set to null (Nothing in Visual Basic).

    • IsCallback is set to false.

    Cross-page posting

    • IsPostBack is set to false.

    • PreviousPage references the source page.

    • IsCrossPagePostBack is set to true.

    • IsCallback is set to false.

    Server transfer

    • IsPostBack is set to false.

    • PreviousPage references the source page.

    • IsCrossPagePostBack that is referenced in the PreviousPage is set to false.

    • IsCallback is set to false.

    Callback

    • IsPostBack is set to false.

    • PreviousPage is set to null (Nothing in Visual Basic).

    • IsCallback is set to true.

    NoteNote

    Be sure you test the IsCrossPagePostBack property of the page that is referenced in PreviousPage. The IsCrossPagePostBack property of the current page always returns false.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker