Show errors in Razor ViewEngine
how i can input detailed information about errors?
i was trying set customErrors mode
to On/Off
, but i have only: Sorry, an error occurred while pro开发者_如何转开发cessing your request.
Yes, once you enable customErrors
it's the contents of the ~/Views/Shared/Error.cshtml
file that you are seeing. You can customize it. It is strongly typed to a System.Web.Mvc.HandleErrorInfo
model and you can extract the exception inside:
@model System.Web.Mvc.HandleErrorInfo
@{
View.Title = "Error";
}
<h2>
Sorry, an error occurred while processing your request.
</h2>
<div>@Model.Exception.ToString()</div>
You also have access to the controller and action that raised the exception inside the model:
@Model.ControllerName
@Model.ActionName
精彩评论