Get ControllerName and ActionName and populate the ViewData in Master Page?

Don’t use ViewData. Use this in your Site.Master instead:

<%= ViewContext.RouteData.Values["Controller"] %>
<%= ViewContext.RouteData.Values["Action"] %>

SO – Getting the name of the controller and action method in the view in ASP.Net MVC

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)