Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines whether the URL parameter contains a valid value for this constraint.
public:
bool Match(System::Web::HttpContextBase ^ httpContext, System::Web::Routing::Route ^ route, System::String ^ parameterName, System::Web::Routing::RouteValueDictionary ^ values, System::Web::Routing::RouteDirection routeDirection);
public bool Match(System.Web.HttpContextBase httpContext, System.Web.Routing.Route route, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection);
abstract member Match : System.Web.HttpContextBase * System.Web.Routing.Route * string * System.Web.Routing.RouteValueDictionary * System.Web.Routing.RouteDirection -> bool
Public Function Match (httpContext As HttpContextBase, route As Route, parameterName As String, values As RouteValueDictionary, routeDirection As RouteDirection) As Boolean
An object that encapsulates information about the HTTP request.
The object that this constraint belongs to.
The name of the parameter that is being checked.
An object that contains the parameters for the URL.
An object that indicates whether the constraint check is being performed when an incoming request is being handled or when a URL is being generated.
true
if the URL parameter contains a valid value; otherwise, false
.
You use the Match method to add validation logic for the constraint. This method is called by the routing framework when an incoming request is processed and when a URL is constructed. You can determine the current scenario by examining the routeDirection
parameter.
When a request is processed, the routing framework determines whether the pattern and values of the incoming request match the pattern and constraints of the route. When a URL is constructed, the routing framework determines whether the values supplied when the GetVirtualPath method is called match the pattern and constraints of the route.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Please sign in to use this experience.
Sign in