什么是RouteData数据类型和RouteTable:
public static RouteData GetRouteDataByUrl(string url) { 返回RouteTable.Routes.GetRouteData(new RewritedHttpContextBase(url)); }
答案 0 :(得分:0)
以下是两个类的公共方法和属性的元数据。首先是RouteData类:
public class RouteData
{
// Summary:
// Initializes a new instance of the System.Web.Routing.RouteData class.
public RouteData();
//
// Summary:
// Initializes a new instance of the System.Web.Routing.RouteData class by using
// the specified route and route handler.
//
// Parameters:
// route:
// An object that defines the route.
//
// routeHandler:
// An object that processes the request.
public RouteData(RouteBase route, IRouteHandler routeHandler);
// Summary:
// Gets a collection of custom values that are passed to the route handler but
// are not used when ASP.NET routing determines whether the route matches a
// request.
//
// Returns:
// An object that contains custom values.
public RouteValueDictionary DataTokens { get; }
//
// Summary:
// Gets or sets the object that represents a route.
//
// Returns:
// An object that represents the route definition.
public RouteBase Route { get; set; }
//
// Summary:
// Gets or sets the object that processes a requested route.
//
// Returns:
// An object that processes the route request.
public IRouteHandler RouteHandler { get; set; }
//
// Summary:
// Gets a collection of URL parameter values and default values for the route.
//
// Returns:
// An object that contains values that are parsed from the URL and from default
// values.
public RouteValueDictionary Values { get; }
// Summary:
// Retrieves the value with the specified identifier.
//
// Parameters:
// valueName:
// The key of the value to retrieve.
//
// Returns:
// The element in the System.Web.Routing.RouteData.Values property whose key
// matches valueName.
//
// Exceptions:
// System.InvalidOperationException:
// A value does not exist for valueName.
public string GetRequiredString(string valueName);
}
其次是RoutTable类:
// Summary:
// Stores the URL routes for an application.
[TypeForwardedFrom("System.Web.Routing, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35")]
public class RouteTable
{
// Summary:
// Initializes a new instance of the System.Web.Routing.RouteTable class.
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public RouteTable();
// Summary:
// Gets a collection of objects that derive from the System.Web.Routing.RouteBase
// class.
//
// Returns:
// An object that contains all the routes in the collection.
public static RouteCollection Routes { get; }
}
您对这些课程有更具体的问题吗?