Route.ProcessConstraint 方法

定义

确定参数值是否与该参数的约束匹配。

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 请求的信息。

constraint
Object

用于测试 parameterName 的正则表达式或对象。

parameterName
String

要测试的参数的名称。

values
RouteValueDictionary

要测试的值。

routeDirection
RouteDirection

一个指定 URL 路由是否处理传入请求或构造 URL 的值。

返回

如果参数值与约束匹配,则为 true;否则为 false

例外

constraint 不是包含正则表达式的字符串。

适用于

另请参阅