Hello friends?
How to get current action method name, controller name in catch block in mvc?
Thanks in advance
public ActionResult Index() { try { } catch (Exception ex) { //how to get current controller name and action result name in this part? } }
Thank you Andrea,
i resolved by using beow code:
string actionName = this.ControllerContext.RouteData.Values["action"].ToString(); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.