c# - MVC Custom Error handling issue -


I am currently working on an MVC application. My problem is that I can not get my customer handling to work correctly.

So what is essential is that I have an exception to test it in an administrator then the application should be redirected to the user / ~ / shared / Errors.cshtml, but for some reason it does not Does.

Here is the code.

Exception is being thrown:

  throw a new exception ("something went wrong");  

Webconfig File:

  & lt; CustomErrors mode = "remote-ONLY" />  

Error controller code:

  public class error controller: controller {// // GET: / error / public performance index () {return view ( ); }}  

Code used in Error.cshtml:

  @ Model system. Web.Mvc.HandleErrorInfo@ {layout = "_Layout.cshtml"; ViewBag.Title = "Error"; } & Lt; Div class = "list-header clearfix" & gt; & Lt; Period & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; Div class = "list-sfs-holder" & gt; & Lt; Div class = "alert warning-error" & gt; An unexpected error has occurred. Please contact the system administrator. & Lt; / Div & gt; @ If (model! = Null & amp; http.nic.in, current .asdbbugging enabled) {& lt; Div & gt; & Lt; P & gt; & Lt; P & gt; Exception: & lt; / P & gt; @model Extension. Message & lt; Br / & gt; & Lt; P & gt; Controller: & lt; / P & gt; @ModelsControllerName & lt; Br / & gt; & Lt; P & gt; Action: & lt; / P & gt; @model.actionememn & lt; / P & gt; & Lt; Div style = "overflow: scroll" & gt; & Lt; Pre & gt; @model Exhibit StackTrace & lt; / Pre & gt; & Lt; / Div & gt; & Lt; / Div & gt; } & Lt; / Div & gt;  

Thank you in advance for any help

The scene should be back in kind.

  See Return ("~ /view / Share / Errors.cshtml");  

Comments