Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could just use a try catch block and in the catch return a View() instead of PartialView().</p> <pre><code>Function GetData() As ActionResult Try ... Return PartialView("_Tab", vmData) Catch ex as Exception //Handle exception here ( send to error log, etc) Return View("~/SystemPages/ErrorPage") End Try </code></pre> <p>OR</p> <p>web.config:</p> <pre><code>&lt;customErrors mode="On"/&gt; </code></pre> <p>BaseController:</p> <pre><code>Protected Overrides Sub OnException(ByVal filterContext As ExceptionContext) If filterContext Is Nothing Then Return Dim Message As String If TypeOf (filterContext.Exception) Is FaultException Then Dim CodeName As String = CType(filterContext.Exception, FaultException).Code.Name Message = CType(filterContext.Exception, FaultException).Message Else Logging.LogDebugData(HamtaDebugInformation(filterContext.RouteData)) Logging.WriteExceptionLog(filterContext.Exception) Message = filterContext.Exception.Message End If Response.Redirect(String.Format("~/Error/HttpError/?message={1}", "HttpError", Message)) End Sub </code></pre> <p>ErrorController:</p> <pre><code>public class ErrorController : Controller { // GET: /Error/HttpError public ActionResult HttpError(string message) { return View("ErrorTest", message); } </code></pre> <p>This post: <a href="https://stackoverflow.com/questions/1171035/asp-net-mvc-custom-error-handling-application-error-global-asax">ASP.NET MVC Custom Error Handling Application_Error Global.asax?</a></p> <p>goes into how to handle each type of error separately. Keep in mind you are handling your exceptions in basecontroller instead of the global.asax file. Which if you were able to change your exception handling, that would be the better way to do it.</p>
 

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