共用方式為


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 不是包含規則運算式的字串。

適用於

另請參閱