public Match ( string path, RouteValueDictionary defaults ) : RouteValueDictionary | ||
path | string | |
defaults | RouteValueDictionary | |
Résultat | RouteValueDictionary |
public override RouteData GetRouteData(HttpContextBase httpContext) { var path = httpContext.Request.AppRelativeCurrentExecutionFilePath; var pathInfo = httpContext.Request.PathInfo; if (!String.IsNullOrEmpty(pathInfo)) { path += pathInfo; } // probably code like this causes ArgumentOutOfRangeException under .NET. // It somehow allows such path that is completely equivalent to the Url. Dunno why. if (Url != path && path.Substring(0, 2) != "~/") { return(null); } path = path.Substring(2); var values = url.Match(path, Defaults); if (values == null) { return(null); } RouteValueDictionary constraints = Constraints; if (constraints != null) { foreach (var p in constraints) { if (!ProcessConstraint(httpContext, p.Value, p.Key, values, RouteDirection.IncomingRequest)) { return(null); } } } var rd = new RouteData(this, RouteHandler); RouteValueDictionary rdValues = rd.Values; foreach (var p in values) { rdValues.Add(p.Key, p.Value); } RouteValueDictionary dataTokens = DataTokens; if (dataTokens != null) { RouteValueDictionary rdDataTokens = rd.DataTokens; foreach (var token in dataTokens) { rdDataTokens.Add(token.Key, token.Value); } } return(rd); }