Wednesday, June 12, 2013

How to get current Action and Controller name in ASP.NET MVC?


From ViewContext
        string action = ViewContext.RouteData.Values["action"].ToString();
        string controller = ViewContext.RouteData.Values["controller"].ToString();

No comments:

Post a Comment