Saturday, August 7, 2010

Display Custom Error View with stack trace in ASP.NET MVC

Excellent ErrorHandler Sample.

Display additional stack trace details in error page in ASP.NET MVC. Scott Gu in his blog mentioned that "To help developers, the default Error view template provided by the new project template in Visual Studio is written to display additional error stack trace information"

I couldn't find as mentioned by scott gu But, got some info from the below blog on stack trace in error view.

http://geekswithblogs.net/ChristiaanVdP/archive/2009/01/08/asp.net-mvc-beta-1-ndash-error-handler-example.aspx.


<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>
Sorry, an error occurred while processing your request.
Action = <%= ViewData.Model.ActionName %>
Controller = <%= ViewData.Model.ControllerName %>
Message = <%= ViewData.Model.Exception.Message %>

</h2>
</asp:Content>

No comments: