語言

IRouteConstraint 介面

定義

定義類別必須實作的契約,以檢查 URL 參數值是否適用於限制條件。

public interface class IRouteConstraint
public interface IRouteConstraint
type IRouteConstraint = interface
Public Interface IRouteConstraint
衍生

備註

當你在路由定義中包含 URL 參數的限制時,必須將 IRouteConstraint 該限制表示為字串或實作介面的物件。 若限制為字串,則視為正則表達式。 當你無法輕易以正規表達式表示驗證邏輯時,你建立 IRouteConstraint 一個類別來實作。 你在方法裡加入驗證邏輯 Match

方法

名稱 Description
Match(HttpContextBase, Route, String, RouteValueDictionary, RouteDirection)

判斷 URL 參數是否包含此限制的有效值。

適用於

另請參閱