You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to make the content finder logic available publicly (extension methods maybe) to enable using from a controller (for example). We have a multi site install using Hybrid Framework route hijacking and virtual nodes with some content retrieved from external web services; we'd like to catch 404 WebExceptions returned from web service calls or HttpExceptions thrown by our controller logic in the base/abstract SurfaceController similar to this:
protected override void OnException(ExceptionContext filterContext)
{
// Bail if we can't do anything; app will crash.
if (filterContext == null)
{
return;
}
if (filterContext.ExceptionHandled)
{
return;
}
var ex = filterContext.Exception ?? new ApplicationException("No further information exists.");
if (ex.IsNotFound()) // IsNotFound checks WebException or HttpException for 404 status
{
// handle this as a 404 using closest not found page for request
var notFoundPage = PageNotFoundContentFinder.NotFoundPage(UmbracoContext.Current.PublishedContentRequest);
var model = ModelLogic.CreateMasterModel(notFoundPage) as MasterModel<NotFound>;
filterContext.Result = View("NotFound", model);
filterContext.HttpContext.Response.StatusCode = (int) HttpStatusCode.NotFound;
filterContext.ExceptionHandled = true;
}
else
{
// Log the exception.
}
}
We have this working using modified code for review/comment (probably should use helper / extension methods)?
The text was updated successfully, but these errors were encountered:
Would it be possible to make the content finder logic available publicly (extension methods maybe) to enable using from a controller (for example). We have a multi site install using Hybrid Framework route hijacking and virtual nodes with some content retrieved from external web services; we'd like to catch 404
WebExceptions
returned from web service calls orHttpExceptions
thrown by our controller logic in the base/abstractSurfaceController
similar to this:We have this working using modified code for review/comment (probably should use helper / extension methods)?
The text was updated successfully, but these errors were encountered: