Export (0) Print
Expand All
Expand Minimize

Page::PreviousPage Property

Gets the page that transferred control to the current page.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

[BrowsableAttribute(false)]
public:
property Page^ PreviousPage {
	Page^ get ();
}

Property Value

Type: System.Web.UI::Page
The Page representing the page that transferred control to the current page.

ExceptionCondition
InvalidOperationException

The current user is not allowed to access the previous page.

-or-

ASP.NET routing is in use and the previous page's URL is a routed URL. When ASP.NET checks access permissions, it assumes that the URL is an actual path to a file. Because this is not the case with a routed URL, the check fails.

When you use the Transfer method or use cross-page posting to transfer processing from one ASP.NET page to another, the originating page contains request information that might be required for the destination page. You can use the PreviousPage property to access that information.

If the current page is being rendered as a result of a direct request (not a transfer or cross-post from another page), the PreviousPage property contains nullptr.

TopicLocation
How to: Pass Values Between ASP.NET Web PagesBuilding ASP .NET Web Applications
How to: Determine How ASP.NET Web Pages Were InvokedBuilding ASP .NET Web Applications
How to: Pass Values Between ASP.NET Web PagesBuilding ASP .NET Web Applications
How to: Determine How ASP.NET Web Pages Were InvokedBuilding ASP .NET Web Applications

The following example is in two parts. The first is an ASP.NET page that uses the Transfer method, exposed in the page model as Server.Transfer("path"). The second part is the target page, which uses the PreviousPage property to get the title of the first page.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft