How to Get current controller or action name in ASP.NET MVC
By FoxLearn 2/18/2024 1:15:07 AM 240
This tutorial shows you how to get current controller or action name in ASP.NET MVC using c# code.
As you know, The RouteData object contains information about the current routing path.
To get a current controller name you can write
@ViewContext.RouteData.Values["controller"].ToString()
and get a current action name
@ViewContext.RouteData.Values["action"].ToString()
- Unable to resolve service for type 'Microsoft.AspNetCore.Identity.RoleManager'
- ASP.NET MVC Responsive Templates Free Download
- How to upload file in ASP.NET MVC
- How to Create Contact Form Flat Responsive in ASP.NET MVC
- HTTP Error 500.30 ASP.NET Core app failed to start
- How to Use IExceptionHandler in ASP.NET Core
- How to custom exception handling in ASP.NET Core
- How to check if HttpPostedFileBase is an image
Categories
Popular Posts
Spica Admin Dashboard Template
11/18/2024