Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save casper-rasmussen/88274446d95a52a6dd981cbb0884b03b to your computer and use it in GitHub Desktop.
Save casper-rasmussen/88274446d95a52a6dd981cbb0884b03b to your computer and use it in GitHub Desktop.
public override object RoutePartial(PageData content, SegmentContext segmentContext)
{
//Ask Episerver to resolve the object for requested URL
object ob = base.RoutePartial(content, segmentContext);
if (ob != null)
{
SegmentPair segment = segmentContext.GetNextValue(segmentContext.RemainingPath);
if (!String.IsNullOrWhiteSpace(segment.Next))
{
//If segment is a part of our predfined list
if (this._segments.Contains(segment.Next, StringComparer.InvariantCultureIgnoreCase))
{
//Then don't tell Episerver about the segment and ensure that it is skipped.
segmentContext.RemainingPath = segment.Remaining;
return ob;
}
}
}
return ob;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment