Created
February 10, 2014 12:07
-
-
Save sniffdk/8914745 to your computer and use it in GitHub Desktop.
PageNotFoundContentFinder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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