1

I am learning elmah for asp.net mvc. I installed elmah with the latest nuget package for elmah with mvc. I have configured it to work with an elmah logging page and to also log the errors in an sql table. I used the script for elmah with sql. My problem is it seems to work everywhere except in partial views. This is a project I inherited so I'm learning how it works. Is there something extra I need to do or look at if Elmah is not picking up 404 errors or exceptions in partial views? I get the asp.net mvc standard 404 error page instead of the one I created to use with elmah and it is not logged anywhere.

here is some of my code:

my FilterConfig.cs includes the following

public class FilterConfig
{
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleAndLogErrorAttribute());
    }
}

public class HandleAndLogErrorAttribute : HandleErrorAttribute
{
    public override void OnException(ExceptionContext filterContext)
    {
        // Log the filterContext.Exception details
        base.OnException(filterContext);
    }

}

my ErrorController.cs class

public class ErrorController : Controller
{
    // The 404 action handler
    // Get: /FailSafe/
    public ActionResult FailSafe()
    {
        Response.StatusCode = 404;
        Response.TrySkipIisCustomErrors = true;
        return View();
    }

}

Any thoughts or direction would be greatly appreciated.

Sue
  • 61
  • 1
  • 1
  • 12

0 Answers0