Route Route Route Route Constructors

Definition

Overloads

Route(String, IRouteHandler) Route(String, IRouteHandler) Route(String, IRouteHandler) Route(String, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern and handler class.

Route(String, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern, default parameter values, and handler class.

Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern, default parameter values, constraints, and handler class.

Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern, default parameter values, constraints, custom values, and handler class.

Route(String, IRouteHandler) Route(String, IRouteHandler) Route(String, IRouteHandler) Route(String, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern and handler class.

public:
 Route(System::String ^ url, System::Web::Routing::IRouteHandler ^ routeHandler);
public Route (string url, System.Web.Routing.IRouteHandler routeHandler);
new System.Web.Routing.Route : string * System.Web.Routing.IRouteHandler -> System.Web.Routing.Route
Public Sub New (url As String, routeHandler As IRouteHandler)

Parameters

url
String String String String

The URL pattern for the route.

routeHandler
IRouteHandler IRouteHandler IRouteHandler IRouteHandler

The object that processes requests for the route.

Examples

The following example shows how to create a Route object and add it to the Routes property.

void Application_Start(object sender, EventArgs e) 
{
    RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routes)
{
    routes.Add(new Route
    (
         "Category/{action}/{categoryName}"
         , new CategoryRouteHandler()
    ));
}
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    RegisterRoutes(RouteTable.Routes)
End Sub

Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
    Dim urlPattern As String
    Dim categoryRoute As Route
    
    urlPattern = "Category/{action}/{categoryName}"
    
    categoryRoute = New Route(urlPattern, New CategoryRouteHandler)
    
    routes.Add(categoryRoute)
End Sub
See also

Route(String, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern, default parameter values, and handler class.

public:
 Route(System::String ^ url, System::Web::Routing::RouteValueDictionary ^ defaults, System::Web::Routing::IRouteHandler ^ routeHandler);
public Route (string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.IRouteHandler routeHandler);
new System.Web.Routing.Route : string * System.Web.Routing.RouteValueDictionary * System.Web.Routing.IRouteHandler -> System.Web.Routing.Route
Public Sub New (url As String, defaults As RouteValueDictionary, routeHandler As IRouteHandler)

Parameters

url
String String String String

The URL pattern for the route.

defaults
RouteValueDictionary RouteValueDictionary RouteValueDictionary RouteValueDictionary

The values to use for any parameters that are missing in the URL.

routeHandler
IRouteHandler IRouteHandler IRouteHandler IRouteHandler

The object that processes requests for the route.

See also

Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern, default parameter values, constraints, and handler class.

public:
 Route(System::String ^ url, System::Web::Routing::RouteValueDictionary ^ defaults, System::Web::Routing::RouteValueDictionary ^ constraints, System::Web::Routing::IRouteHandler ^ routeHandler);
public Route (string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.IRouteHandler routeHandler);
new System.Web.Routing.Route : string * System.Web.Routing.RouteValueDictionary * System.Web.Routing.RouteValueDictionary * System.Web.Routing.IRouteHandler -> System.Web.Routing.Route
Public Sub New (url As String, defaults As RouteValueDictionary, constraints As RouteValueDictionary, routeHandler As IRouteHandler)

Parameters

url
String String String String

The URL pattern for the route.

defaults
RouteValueDictionary RouteValueDictionary RouteValueDictionary RouteValueDictionary

The values to use if the URL does not contain all the parameters.

constraints
RouteValueDictionary RouteValueDictionary RouteValueDictionary RouteValueDictionary

A regular expression that specifies valid values for a URL parameter.

routeHandler
IRouteHandler IRouteHandler IRouteHandler IRouteHandler

The object that processes requests for the route.

See also

Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler) Route(String, RouteValueDictionary, RouteValueDictionary, RouteValueDictionary, IRouteHandler)

Initializes a new instance of the Route class, by using the specified URL pattern, default parameter values, constraints, custom values, and handler class.

public:
 Route(System::String ^ url, System::Web::Routing::RouteValueDictionary ^ defaults, System::Web::Routing::RouteValueDictionary ^ constraints, System::Web::Routing::RouteValueDictionary ^ dataTokens, System::Web::Routing::IRouteHandler ^ routeHandler);
public Route (string url, System.Web.Routing.RouteValueDictionary defaults, System.Web.Routing.RouteValueDictionary constraints, System.Web.Routing.RouteValueDictionary dataTokens, System.Web.Routing.IRouteHandler routeHandler);
new System.Web.Routing.Route : string * System.Web.Routing.RouteValueDictionary * System.Web.Routing.RouteValueDictionary * System.Web.Routing.RouteValueDictionary * System.Web.Routing.IRouteHandler -> System.Web.Routing.Route
Public Sub New (url As String, defaults As RouteValueDictionary, constraints As RouteValueDictionary, dataTokens As RouteValueDictionary, routeHandler As IRouteHandler)

Parameters

url
String String String String

The URL pattern for the route.

defaults
RouteValueDictionary RouteValueDictionary RouteValueDictionary RouteValueDictionary

The values to use if the URL does not contain all the parameters.

constraints
RouteValueDictionary RouteValueDictionary RouteValueDictionary RouteValueDictionary

A regular expression that specifies valid values for a URL parameter.

dataTokens
RouteValueDictionary RouteValueDictionary RouteValueDictionary RouteValueDictionary

Custom values that are passed to the route handler, but which are not used to determine whether the route matches a specific URL pattern. These values are passed to the route handler, where they can be used for processing the request.

routeHandler
IRouteHandler IRouteHandler IRouteHandler IRouteHandler

The object that processes requests for the route.

See also

Applies to