Getting shape to display on ErrorPage.cshtml

Topics: General
Aug 20, 2012 at 4:49 PM

Using 1.4 I set up NotFound.cshtml and ErrorPage.cshtml under my Theme.  I was able to get some widget content to appear in NotFound.cshtml by doing the following:

@using Orchard.Utility.Extensions;
@{
    Layout.Title = Model.Title;
    var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();

    WorkContext.Layout.AsideSecond.Add(New.AsideSecondQuestionsComments(), "5");
    ...
 }
<h1>@Html.TitleForPage(T("Sorry, Page Not Found").ToString())</h1>
<p>@T("The page you are looking for does not exist. Please check the spelling of the page and try re-entering it again in your browser's address bar; otherwise use one of the links on this page to navigate around the website.")</p>

where I created a file AsideSecondQuestionsComments.cshtml in the Views folder that contains NotFound.cshtml.

This works fine on that file (when I input a www.mysite.com/NotARealPage the NotFound page pops up and my widgets show up along with the stock "Page Not Found").

However, when I do the same exact thing for ErrorPage.csthml, none of the widgets show up, only the message in the file:

<h1 id="page-title">@Html.TitleForPage(T("Oops. Something Went Wrong ... Sorry"))</h1>
  <div>
      <p>@T("An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, please go back.").Text</p>
  </div> 

The ErrorPage.cshtml has the same content in the @{ } block as NotFound.cshtml. Any thoughts?