Export (0) Print
Expand All
29 out of 40 rated this helpful - Rate this topic

Page::PreviousPage Property

Updated: October 2009

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.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0

Date

History

Reason

October 2009

Added notes about when the property might be nullptr and about exceptions that might be raised when ASP.NET routing is used.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.