Hello friends,
I need some help to catch exception using 1 common way across all controllers
In below code I used try catch block to catch exception and send mail.
But i don't want to use try catch block in all action result methods in all controllers.
Please help to solve
public ActionResult Contact(Useful_info usi)
{
try
{
usi.SuportTeam = db.SupportTeam.ToList();
ViewBag.Message = "Your contact page.";
}
catch(Exception ex)
{
string result = exceptionmail.MailExceptionDetails(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), ex.Message, new System.Diagnostics.StackTrace(ex, true));
return View("Error");
}
return View(usi);
}