Is there a way in a view in ASP.Net MVC to get the names of the controller and actien method that are using the view?
Actions are public methods in an MVC controller, that respond to a URL request. Action Selectors are attributes that can be applied to action methods and are used to influence or control which action method gets invoked in response to a request.
Try this:
<%= ViewContext.RouteData.Values["Controller"] %> <%= ViewContext.RouteData.Values["Action"] %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With