Route.ProcessConstraint(HttpContextBase, Object, String, RouteValueDictionary, RouteDirection) 方法
定义
确定参数值是否与该参数的约束匹配。Determines whether a parameter value matches the constraint for that parameter.
protected:
virtual bool ProcessConstraint(System::Web::HttpContextBase ^ httpContext, System::Object ^ constraint, System::String ^ parameterName, System::Web::Routing::RouteValueDictionary ^ values, System::Web::Routing::RouteDirection routeDirection);
protected virtual bool ProcessConstraint (System.Web.HttpContextBase httpContext, object constraint, string parameterName, System.Web.Routing.RouteValueDictionary values, System.Web.Routing.RouteDirection routeDirection);
abstract member ProcessConstraint : System.Web.HttpContextBase * obj * string * System.Web.Routing.RouteValueDictionary * System.Web.Routing.RouteDirection -> bool
override this.ProcessConstraint : System.Web.HttpContextBase * obj * string * System.Web.Routing.RouteValueDictionary * System.Web.Routing.RouteDirection -> bool
Protected Overridable Function ProcessConstraint (httpContext As HttpContextBase, constraint As Object, parameterName As String, values As RouteValueDictionary, routeDirection As RouteDirection) As Boolean
参数
- httpContext
- HttpContextBase
一个对象,该对象封装有关 HTTP 请求的信息。An object that encapsulates information about the HTTP request.
- constraint
- Object
用于测试 parameterName 的正则表达式或对象。The regular expression or object to use to test parameterName.
- parameterName
- String
要测试的参数的名称。The name of the parameter to test.
- values
- RouteValueDictionary
要测试的值。The values to test.
- routeDirection
- RouteDirection
一个指定 URL 路由是否处理传入请求或构造 URL 的值。A value that specifies whether URL routing is processing an incoming request or constructing a URL.
返回
如果参数值与约束匹配,则为 true;否则为 false。true if the parameter value matches the constraint; otherwise, false.
例外
constraint 不是包含正则表达式的字符串。constraint is not a string that contains a regular expression.