Skip to content

Instantly share code, notes, and snippets.

@sniffdk
Created February 10, 2014 12:07
Show Gist options
  • Save sniffdk/8914745 to your computer and use it in GitHub Desktop.
Save sniffdk/8914745 to your computer and use it in GitHub Desktop.
PageNotFoundContentFinder
public bool TryFindContent(PublishedContentRequest contentRequest)
{
if (contentRequest.Is404)
{
var site = SiteHelpers.GetSite();
var page404 = site.Get404Page();
if (page404 != null)
{
contentRequest.PublishedContent = contentRequest.RoutingContext.UmbracoContext.ContentCache.GetById(page404.Id);
}
}
return contentRequest.PublishedContent != null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment