Search This Blog

Sunday, July 14, 2019

Handle Error MVC

Asp.net MVC framework provies a built in filter  to handle exception and this filter is known
HandleError



To use HandleError  in MVC application following three things are required

  • Enable custom error in web config
  • Add Error.cshtml view in shared folder
  • Use HandleError at Action/Controller/Global

        [HandleError ]  // filter at action level
        public ActionResult Index()
        {
            throw new Exception("this is exception");
        }

No comments :