public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { if (values.ContainsKey("namespaces")) { var ns = (IEnumerable <string>)values["namespaces"]; var routeValues = new RouteValueDictionary(values); routeValues.Remove("namespaces"); var virtualPathData = baseRoute.GetVirtualPath(requestContext, routeValues); if (virtualPathData != null) { var namespacesOfVirtualPathData = virtualPathData.DataTokens["namespaces"] as IEnumerable <string>; if (namespacesOfVirtualPathData == null) { return(null); } return(namespacesOfVirtualPathData.ToList().SequenceEqual(ns) ? virtualPathData : null); } return(null); } return(baseRoute.GetVirtualPath(requestContext, values)); }
public VirtualPathData GetVirtualPath(VirtualPathContext context) { foreach (var matcherParameter in _matcher.Template.Parameters) { context.Values.Remove(matcherParameter.Name); // make sure none of the domain-placeholders are appended as query string parameters } return(_innerRoute.GetVirtualPath(context)); }
public static string Url(RouteBase route, RouteValueDictionary value) { var url1 = route.GetVirtualPath(Ctx, value); if (url1 == null) { return(string.Empty); } return(url1.VirtualPath); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { values = new RouteValueDictionary(values.Select(v => { return(v.Key.Equals("action") || v.Key.Equals("controller") ? new KeyValuePair <String, Object>(v.Key, (v.Value as String).ToLower()) : v); }).ToDictionary(v => v.Key, v => v.Value)); return(route.GetVirtualPath(requestContext, values)); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { var path = _Route.GetVirtualPath(requestContext, values); if (path != null) { LowercaseUrlPath(path); } return(path); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { var virtualPath = _route.GetVirtualPath(requestContext, values); if (virtualPath == null) { return(null); } return(virtualPath); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { VirtualPathData path = _innerRoute.GetVirtualPath(requestContext, values); if (path != null && path.VirtualPath != null) { string virtualPath = path.VirtualPath; path.VirtualPath = ToLowerVirtualPath(virtualPath); } return(path); }
public static string GetPackageDownloadUrl(Package package) { var routesValues = new RouteValueDictionary { { "packageId", package.Id }, { "version", package.Version.ToString() } }; var context = HttpContext.Current; RouteBase route = RouteTable.Routes["DownloadPackage"]; var vpd = route.GetVirtualPath(context.Request.RequestContext, routesValues); string applicationPath = Helpers.EnsureTrailingSlash(context.Request.ApplicationPath); return(applicationPath + vpd.VirtualPath); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { // only if MVC or WebApi match for this route object httpRouteValue; if (values.TryGetValue("httproute", out httpRouteValue)) { if (httpRouteValue is bool && (bool)httpRouteValue != IsHttpRoute) { return(null); } } // // locate appropriate shell settings for request // var settings = _runningShellTable.Match(requestContext.HttpContext); // // // only proceed if there was a match, and it was for this client // if (settings == null || settings.Name != _shellSettings.Name) // return null; var effectiveRequestContext = requestContext; // if (_urlPrefix != null) // effectiveRequestContext = // new RequestContext(new UrlPrefixAdjustedHttpContext(requestContext.HttpContext, _urlPrefix), // requestContext.RouteData); var virtualPath = _route.GetVirtualPath(effectiveRequestContext, values); if (virtualPath == null) { return(null); } // if (_urlPrefix != null) // virtualPath.VirtualPath = _urlPrefix.PrependLeadingSegments(virtualPath.VirtualPath); return(virtualPath); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { string currentCulture = Thread.CurrentThread.CurrentUICulture.Name; // If specific path is requested, override culture and remove RouteValue if (values.ContainsKey("culture")) { currentCulture = (string)values["culture"]; } RouteBase localizationRoute = GetLocalizedOrDefaultRoute(currentCulture); if (localizationRoute == null) { return(null); } // Get translated route from child route VirtualPathData pathData = localizationRoute.GetVirtualPath(requestContext, new RouteValueDictionary(CopyAndRemoveFromValueDictionary(values))); return(pathData); }
public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { return(_route.GetVirtualPath(requestContext, values)); }