public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            // Don't compute unnecessary virtual path if the map is empty.
            if (!mAliasMap.Any())
            {
                return(null);
            }

            var requestPath = GetRequestPath(httpContext);

            var aliasInfo = PartialAliasHelper.GetClosestParentAlias(requestPath, mAliasMap, false);

            if (aliasInfo != null)
            {
                httpContext.Items.Add("AutoroutePath", aliasInfo.Path);
                return(CreateRouteData(aliasInfo));
            }

            return(null);
        }
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            // don't compute unnecessary virtual path if the map is empty
            if (!_aliasMap.Any())
            {
                return(null);
            }

            // Get the full inbound request path
            var virtualPath = httpContext.Request.AppRelativeCurrentExecutionFilePath.Substring(2) + httpContext.Request.PathInfo;

            // Attempt to lookup RouteValues in the alias map
            //IDictionary<string, string> routeValues;
            AliasInfo aliasInfo;

            // TODO: Might as well have the lookup in AliasHolder...
            if (_aliasMap.TryGetAlias(virtualPath, out aliasInfo))
            {
                // Construct RouteData from the route values
                var data = new RouteData(this, _routeHandler);
                foreach (var routeValue in aliasInfo.RouteValues)
                {
                    var key = routeValue.Key;
                    if (key.EndsWith("-"))
                    {
                        data.Values.Add(key.Substring(0, key.Length - 1), routeValue.Value);
                    }
                    else
                    {
                        data.Values.Add(key, routeValue.Value);
                    }
                }

                data.Values["area"]     = Area;
                data.DataTokens["area"] = Area;

                return(data);
            }
            return(null);
        }