This documentation is archived and is not being maintained.

RouteCollection.MapPageRoute Method (String, String, String)

Provides a way to define routes for Web Forms applications.

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

public Route MapPageRoute(
	string routeName,
	string routeUrl,
	string physicalFile


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.

Return Value

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

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. The first statement defines a route that does not have a name. The second statement defines a named route. This example is part of a larger example that is available in the MapPageRoute method overview.

    "SalesReport/{locale}/{year}/{*queryvalues}", "~/sales.aspx");

    "SalesReportSummary/{locale}", "~/sales.aspx");

.NET Framework

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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