Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC error page is loaded in partial view
    text
    copied!<p>I have a error page with layout that works fine in most cases but when there is an error in a controller that returns a partial view the error page and its layout is placed in the partial view. I guess thats logical but I want the error page to be loaded as full page. How do I accomplish that without changing all error handling. </p> <p>web.config:</p> <pre><code>&lt;customErrors mode="On" defaultRedirect="~/Error"&gt; &lt;error statusCode="500" redirect="~/SystemPages/ErrorPage" /&gt; &lt;error statusCode="403" redirect="~/SystemPages/FileNotFound" /&gt; &lt;error statusCode="404" redirect="~/SystemPages/FileNotFound" /&gt; &lt;/customErrors&gt; </code></pre> <p>Global.asax:</p> <pre><code>Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection) filters.Add(New HandleErrorAttribute()) End Sub </code></pre> <p>BaseController:</p> <pre><code>Protected Overrides Sub OnException(ByVal filterContext As ExceptionContext) If filterContext Is Nothing Then Return If TypeOf (filterContext.Exception) Is FaultException Then Dim CodeName As String = CType(filterContext.Exception, FaultException).Code.Name Dim Message As String = CType(filterContext.Exception, FaultException).Message TempData("ErrorMessage") = Message Else Logging.LogDebugData(HamtaDebugInformation(filterContext.RouteData)) Logging.WriteExceptionLog(filterContext.Exception) TempData("ErrorMessage") = filterContext.Exception.Message End If Response.Redirect("/SystemPages/ErrorPage") End Sub </code></pre> <p>SearchController:</p> <pre><code> Function GetData() As ActionResult ... Return PartialView("_Tab", vmData) </code></pre> <p>ErrorPage:</p> <pre><code>@Code ViewData("Title") = "ErrorPage" Layout = "~/Views/Shared/_Layout.vbhtml" End Code &lt;div id="mainContent" class="oneColumn"&gt; &lt;div class="panel"&gt; &lt;span class="panelTLC"&gt;&lt;/span&gt; &lt;span class="panelTRC"&gt;&lt;/span&gt; &lt;div id="inputPanel" class="panelContent"&gt; &lt;div class="modul"&gt; &lt;div class="modulHead"&gt; &lt;span class="TLC"&gt;&lt;/span&gt; &lt;span class="TRC"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="modulContent"&gt; &lt;span class="TLC"&gt;&lt;/span&gt;&lt;span class="TRC"&gt;&lt;/span&gt; &lt;p&gt;@ViewBag.ErrorMessage&lt;/p&gt; &lt;p&gt;@TempData("ErrorMessage")&lt;/p&gt; &lt;span class="BLC"&gt;&lt;/span&gt; &lt;span class="BRC"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;span class="panelBLC"&gt;&lt;/span&gt;&lt;span class="panelBRC"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
 

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