I am trying to handle exception in asp.net MVC application using [HandleError].

I changed in web config <customErrors mode="On" />

Its not working for Cutom Error Like NotImplementedException

I have Kept CustomErrorView in shared folder.

Please Help....

namespace MvcApplicationErrorHandling.Controllers
{
    [HandleError(Order = 2)]
    [HandleError(ExceptionType = typeof(NotImplementedException), View = "CustomErrorView")]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult ThrowException()
        {
            throw new ApplicationException();
        }

        public ActionResult ErrorDemo()
        {
            string strtemp;
            Object obj = null;
            strtemp = obj.ToString();

            return View();
        }

        public ActionResult ThrowNotImplemented()
        {
            throw new NotImplementedException();
        }
    }
}
0

There are 0 best solutions below