Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 Custom/Http error pages not shown for View exceptions
    primarykey
    data
    text
    <p>I have custom/http errors set up in an ASP.NET MVC 3 application that will be shown on errors. My <code>Web.Config</code>'s <code>httpErrors</code> section looks like this:</p> <pre><code> &lt;httpErrors errorMode="Custom" existingResponse="Replace"&gt; &lt;remove statusCode="400" /&gt; &lt;remove statusCode="403" /&gt; &lt;remove statusCode="404" /&gt; &lt;remove statusCode="408" /&gt; &lt;remove statusCode="500" /&gt; &lt;remove statusCode="503" /&gt; &lt;error statusCode="400" responseMode="ExecuteURL" path="/Error/BadRequest" /&gt; &lt;error statusCode="403" responseMode="ExecuteURL" path="/Error/Forbidden" /&gt; &lt;error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" /&gt; &lt;error statusCode="408" responseMode="ExecuteURL" path="/Error/Timeout" /&gt; &lt;error statusCode="500" responseMode="ExecuteURL" path="/Error/InternalServerError" /&gt; &lt;error statusCode="503" responseMode="ExecuteURL" path="/Error/ServiceUnavailable" /&gt; &lt;/httpErrors&gt; </code></pre> <p>I haven't set the <code>customerErrors</code> setting as this doesn't work well with MVC &amp; IIS 7.5.</p> <p>All works fine, when an exception occurs in code.</p> <p>However, when an exception is thrown in a view - it tries to show the default <code>~/Views/Shared/Error.cshtml</code> which I don't have.</p> <p>The view that might throw an error could be this:</p> <pre><code>@Html.Partial("TemplateSection", Model.PreContent) </code></pre> <p>And imagine <code>PreContent</code> is null, and the <code>TemplateSection</code> view will fail when displaying values by doing this: <code>@Model.Name</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload