Logging errors in ASP.NET MVC

前端 未结 6 1342
温柔的废话
温柔的废话 2020-12-07 06:55

I\'m currently using log4net in my ASP.NET MVC application to log exceptions. The way I\'m doing this is by having all my controllers inherit from a BaseController class.

6条回答
  •  情深已故
    2020-12-07 07:42

    The Error.aspx view is defined like this:

    namespace MvcApplication1.Views.Shared
    {
        public partial class Error : ViewPage
        {
        }
    }
    

    The HandleErrorInfo has three properties: string ActionName string ControllerName Exception Exception

    You should be able to access HandleErrorInfo and therefore the Exception within the view.

提交回复
热议问题