HttpRouteCollectionExtensions.MapHttpRoute Method (HttpRouteCollection, String, String)

Maps the specified route template.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function MapHttpRoute ( _
    routes As HttpRouteCollection, _
    name As String, _
    routeTemplate As String _
) As IHttpRoute
'Usage
Dim routes As HttpRouteCollection 
Dim name As String 
Dim routeTemplate As String 
Dim returnValue As IHttpRoute 

returnValue = routes.MapHttpRoute(name, _
    routeTemplate)
public static IHttpRoute MapHttpRoute(
    this HttpRouteCollection routes,
    string name,
    string routeTemplate
)
[ExtensionAttribute]
public:
static IHttpRoute^ MapHttpRoute(
    HttpRouteCollection^ routes, 
    String^ name, 
    String^ routeTemplate
)
static member MapHttpRoute : 
        routes:HttpRouteCollection * 
        name:string * 
        routeTemplate:string -> IHttpRoute
public static function MapHttpRoute(
    routes : HttpRouteCollection, 
    name : String, 
    routeTemplate : String
) : IHttpRoute

Parameters

  • routeTemplate
    Type: System.String
    The route template for the route.

Return Value

Type: System.Web.Http.Routing.IHttpRoute
A reference to the mapped route.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpRouteCollection. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.118) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.118).

Remarks

For an overview of Web API routing, see Routing in ASP.NET Web API. For more details, see Routing and Action Selection.

See Also

Reference

HttpRouteCollectionExtensions Class

MapHttpRoute Overload

System.Web.Http Namespace