Share via


HttpMethodConstraint.IHttpRouteConstraint.Match Method

Determines whether the request was made with an HTTP verb that is one of the allowed verbs for the route.

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

Syntax

'Declaration
Private Function Match ( _
    request As HttpRequestMessage, _
    route As IHttpRoute, _
    parameterName As String, _
    values As IDictionary(Of String, Object), _
    routeDirection As HttpRouteDirection _
) As Boolean Implements IHttpRouteConstraint.Match
'Usage
Dim instance As HttpMethodConstraint
Dim request As HttpRequestMessage
Dim route As IHttpRoute
Dim parameterName As String
Dim values As IDictionary(Of String, Object)
Dim routeDirection As HttpRouteDirection
Dim returnValue As Boolean

returnValue = CType(instance, IHttpRouteConstraint).Match(request, _
    route, parameterName, values, routeDirection)
bool IHttpRouteConstraint.Match(
    HttpRequestMessage request,
    IHttpRoute route,
    string parameterName,
    IDictionary<string, Object> values,
    HttpRouteDirection routeDirection
)
private:
virtual bool Match(
    HttpRequestMessage^ request, 
    IHttpRoute^ route, 
    String^ parameterName, 
    IDictionary<String^, Object^>^ values, 
    HttpRouteDirection routeDirection
) sealed = IHttpRouteConstraint::Match
private abstract Match : 
        request:HttpRequestMessage * 
        route:IHttpRoute * 
        parameterName:string * 
        values:IDictionary<string, Object> * 
        routeDirection:HttpRouteDirection -> bool 
private override Match : 
        request:HttpRequestMessage * 
        route:IHttpRoute * 
        parameterName:string * 
        values:IDictionary<string, Object> * 
        routeDirection:HttpRouteDirection -> bool 
JScript supports the use of explicit interface implementations, but not the declarations of new ones.

Parameters

  • request
    Type: HttpRequestMessage
    The request that is being checked to determine whether it matches the URL.
  • parameterName
    Type: System.String
    The name of the parameter that is being checked.

Return Value

Type: System.Boolean
When ASP.NET routing is processing a request, true if the request was made by using an allowed HTTP verb; otherwise, false. When ASP.NET routing is constructing a URL, true if the supplied values contain an HTTP verb that matches one of the allowed HTTP verbs; otherwise, false. The default is true.

Implements

IHttpRouteConstraint.Match(HttpRequestMessage, IHttpRoute, String, IDictionary<String, Object>, HttpRouteDirection)

See Also

Reference

HttpMethodConstraint Class

System.Web.Http.Routing Namespace