Maverick.Web.Routing.PagePrerouter.GetRouteData C# (CSharp) Метод

GetRouteData() публичный Метод

public GetRouteData ( System.Web.HttpContextBase httpContext ) : System.Web.Routing.RouteData
httpContext System.Web.HttpContextBase
Результат System.Web.Routing.RouteData
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            PortalRequestContext context = httpContext.GetPortalContext();
            if(context.ActivePage != null) {
                return null;
            }

            string pagePath = httpContext.Request.AppRelativeCurrentExecutionFilePath;

            // Normalize path to the form: /Segment/Segment/Segment
            pagePath = NormalizePagePath(pagePath);

            // Search for the page
            Page page = PageRepository.GetLongestPrefixMatch(pagePath);

            // If there is no matching page, return null
            if(page == null) {
                return null;
            }

            // Set the page in the context
            context.ActivePage = page;

            // Remove the actual page path and set as the new app-relative path
            string appRelativePath = pagePath.Substring(page.Path.Length);

            // Rewrite and reroute the request
            // TODO: Can HttpContext.RewritePath do what we need?  I do want to preserve the old HttpContext for use after routing
            HttpContextBase rewrittenContext = new RewrittenHttpContext(httpContext, appRelativePath);
            return RerouteRequest(r => r.GetRouteData(rewrittenContext));
        }