Export (0) Print
Expand All

RouteCollection::MapPageRoute Method (String, String, String, Boolean, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary)

Provides a way to define routes for Web Forms applications.

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

Route^ MapPageRoute(
	String^ routeName, 
	String^ routeUrl, 
	String^ physicalFile, 
	bool checkPhysicalUrlAccess, 
	RouteValueDictionary^ defaults, 
	RouteValueDictionary^ constraints, 
	RouteValueDictionary^ dataTokens


Type: System::String

The name of the route.

Type: System::String

The URL pattern for the route.

Type: System::String

The physical URL for the route.

Type: System::Boolean

A value that indicates whether ASP.NET should validate that the user has authority to access the physical URL (the route URL is always checked). This parameter sets the PageRouteHandler::CheckPhysicalUrlAccess property.

Type: System.Web.Routing::RouteValueDictionary

Default values for the route parameters.

Type: System.Web.Routing::RouteValueDictionary

Constraints that a URL request must meet in order to be processed as this route.

Type: System.Web.Routing::RouteValueDictionary

Values that are associated with the route that are not used to determine whether a route matches a URL pattern.

Return Value

Type: System.Web.Routing::Route
The route that is added to the route collection.


The routeUrl parameter is nullptr.

This method is provided for coding convenience. It is equivalent to calling the Add method and passing a Route object that is created by using the PageRouteHandler class.

The following example shows how to define a route by using this method. This example is part of a larger example that is available in the MapPageRoute method overview.

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

.NET Framework

Supported in: 4.6, 4.5, 4

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.

© 2014 Microsoft