Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Trouble understanding partial route and SegmentContext

$
0
0

Hi, there,

I am trying to fix a problem that arose on my site when I upgraded from 7.11 to 8.9. The consultants who built the site created a partial routers for four of the custom content types that they created. Everything works except for one.

After carefully stepping through the code, I found that it seems like the system finds the page, but at the very last call it loses its info and then returns "Page Not Found".

While reading the documentation, blog entries, and forum posts, I keep running into code that looks like this, which my system also has something similiar

        public object RoutePartial(CarDetailsPage content, SegmentContext segmentContext)
        {
            //Expected format is RegNumber/
            var regNumber = segmentContext.GetNextValue(segmentContext.RemainingPath);
            if (!String.IsNullOrEmpty(regNumber.Next))
            {
                segmentContext.SetCustomRouteData<CarDetailsPageTemplate>();
                return content;
            }
            return null;
        }

I understand the return of content or null. What I don't understand is why segmentContext is being updated. Is segmentContext part of the content object?  Is it a reference to some global property?


Viewing all articles
Browse latest Browse all 9076

Trending Articles