I do have created an Error View for a MVC C# App, and it is very simple but I can manage to show the controller, actioin and the message from where the exception happens(I need it for develepment purposes) But it always throw an exception in code. this is my global.asax
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
protected void Application_Error(object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
Server.ClearError();
Response.Redirect("/ErrorPage/ErrorMessage");
}
this is my ErrorrPageController
public class ErrorPageController : Controller
{
public ActionResult ErrorMessage()
{
return View();
}
}
and this is the view that throws the error, it throws errors in @Model.ControllerName, @Model.ActionName and @Model.Exception.Message
@model System.Web.Mvc.HandleErrorInfo
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div>
<br />
<div class="form-group">
<div class="row">
<div class="col-md-12">
<img src="~/Imagenes/logo.png" class="img-responsive center-block" />
</div>
</div>
<h2>Ooops an error has been triggered</h2>
<p>Controller = @Model.ControllerName</p>
<p>Action = @Model.ActionName</p>
<p>Message = @Model.Exception.Message</p>
</div>
@*<hr />*@
<br />
<div class="form-group">
<div class="col-md-12">
<a href="@Url.Action("TipoEvento", "Home")" class="pull-right linkedin-link">Regresar <i class="fa fa-angle-right"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
and this is the error that throws
But I really need to show those info(again, for dev purposes), so, could you please help me and tell how to show the detailed error info in the error page