public override RouteData GetRouteData(HttpContextBase httpContext) { // Optimize matching by comparing the static left part of the route url with the requested path. var requestedPath = httpContext.Request.AppRelativeCurrentExecutionFilePath.Substring(2) + httpContext.Request.PathInfo; if (!this.IsLeftPartOfUrlMatched(requestedPath)) return null; // Let the underlying route match, and if it does, then add a few more constraints. var routeData = base.GetRouteData(httpContext); if (routeData == null) return null; // Constrain by subdomain if configured var host = httpContext.SafeGet(ctx => ctx.Request.Headers["host"]); if (!this.IsSubdomainMatched(host, _configuration)) return null; // Constrain by culture name if configured var currentUICultureName = _configuration.CurrentUICultureResolver(httpContext, routeData); if (!this.IsCultureNameMatched(currentUICultureName, _configuration)) return null; return routeData; }
public override RouteData GetRouteData(HttpContextBase httpContext) { // Let the underlying route match, and if it does, then add a few more constraints. var routeData = base.GetRouteData(httpContext); if (routeData == null) return null; // Constrain by subdomain if configured var host = httpContext.SafeGet(ctx => ctx.Request.Headers["host"]); if (!this.IsSubdomainMatched(host, _configuration)) return null; // Constrain by culture name if configured var currentUICultureName = _configuration.CurrentUICultureResolver(httpContext, routeData); if (!this.IsCultureNameMatched(currentUICultureName, _configuration)) return null; return routeData; }