Page::PreviousPage Property

 

Gets the page that transferred control to the current page.

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

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

Property Value

Type: System.Web.UI::Page^

The Page representing the page that transferred control to the current page.

Exception Condition
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 null.

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
Available since 2.0
Return to top
Show: