If you in your partial router implementation want to route to some other content item then in your partial route implementation you should update RoutedContentLink on the passed in SegmentContext instance.
Given that you have done that then after routing is completed (e.g. in a controller or a actionfilter) can you use extension method ReuestContext.GetContentLink to get the content that was finally routed to (in your case it should be the content your partial router routed to). The extension method ReuestContext.GetOriginalContentLink will give you a reference to the content that was routed to before the partial routing took over.
Wow! That is a vital piece of information. I wasn't aware the SegmentContext was for anything more than read access to the route. My partial router was not setting RoutedContentLink. In addition to making the page available via GetContentLink(), PageContext.Page also now returns the correct page. I'm very new to EPiServer and am still trying to learn how to learn it. I don't see this mentioned under partial routing or in the news example. Is there somewhere I might have gone to find this info? Thanks so much, I was about to abandon the partial routing altogether.
We have set up our site with a partial router that routes the virtual path mysite/SubsiteName to the actual page mysite/Subsites/SubsiteName. It can also route to child pages of SubsiteName so it essentially just hides the Subsites container page from the URL. So initially the node found is just the mysite StartPage and then the partial router returns the Subsites/SubsiteName page. I'm trying to set up a base controller that provides a default page model for other controllers to inherit from. In order to do this, I need to get the current page. However, when the partial routing has taken place, PageContext.Page is still set to StartPage, which was the current page before partial routing routed us to the SubsiteName page. My controller's action method receives a currentPage parameter equal to the SubsiteName page so I know it's there somewhere. How can I find the SubsiteName page that we're actually delivering in the OnActionExecuting method of my controller?
: PageController
public class PageControllerBase
where T : SitePageData
{
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);
//If requested url = mysite/SubsiteName
//I need access to the SubsiteName page
//PageContext.Page is the site's StartPage after PartialRouter has routed to Subsites/SubsiteName
This will also need to include any child pages of SubsiteName like mysite/SubsiteName/Page1 (which the partial router also already handles).