RouteBase類,RouteData類,RouteValueDictionary類
1.RouteBase是一個抽象基類,定義了兩個功能:
1.從HttpContextBase中根據Route Map規則得到RouteData
2.得到虛擬路徑數據(將在 Route 類(下) 中講解)
using System.Security.Permissions; using System.Web; namespace System.Web.Routing { [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public abstract class RouteBase { // Methods public abstract RouteData GetRouteData(HttpContextBase httpContext); public abstract VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values); } }
2. RouteData類,保存Route數據的類,提供如下功能
1.可保存對Route和RouteHandler的引用(基類和接口)
2.保存兩個鍵值對,分別存儲RouteValues 和用戶自傳入的DataToken