How can I get the Viewbag title of the controllers index?
For example, if I am at mysite.com/MyController/MyAction
, I would like to render the Viewbag title from the controllers index, being mysite.com/MyController
.
The Viewbag title for the index would be "My Controller".
I attempted to get the controller name and render it as a string, although that is not ideal. I did that using the following:
@HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString())