@{
var controllerName = this.ViewContext.RouteData.Values["controller"].ToString();
}
OR
@{
var controllerName = HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
}
More Related Contents:
- Post an HTML Table to ADO.NET DataTable
- Pass List of Checkboxes into View and Pull out IEnumerable [duplicate]
- Weird Error Upgrading ASP.NET MVC from 4 to 5
- MVC 5 Dynamic Rows with BeginCollectionItem
- How to represent a month of checkboxes in an MVC model
- Complex object and model binder ASP.NET MVC
- c# asp.net delete last comma [closed]
- MVC5 Razor html.dropdownlistfor set selected when value is in array
- How to pass IEnumerable list to controller in MVC including checkbox state?
- DropDownList in MVC 4 with Razor
- @Html.DropDownListFor how to set default value [duplicate]
- How do I implement a custom RazorViewEngine to find views in non-standard locations?
- How to render a Razor View to a string in ASP.NET MVC 3?
- @Html.Action in Asp.Net Core
- DisplayNameFor() From List in Model
- ASP.NET MVC DropDownListFor with model of type List
- Do I need a Global.asax.cs file at all if I’m using an OWIN Startup.cs class and move all configuration there?
- How do I define a method in Razor?
- Get Current Area Name in View or Controller
- ASP.Net MVC route to catch all *.aspx requests
- ASP.NET MVC get textbox input value
- Incorrect List Model Binding indices when using HTML Helpers
- Date of Birth validation keeps showing
- Possible to access MVC ViewBag object from Javascript file?
- Method ‘RouteCollection.get_AppendTrailingSlash’ not found when using Razor Url helpers in ASP.NET MVC 5 Mono
- Get UserID of logged-in user in Asp.Net MVC 5
- Correct way to use HttpContext.Current.User with async await
- Razor/CSHTML – Any Benefit over what we have? [closed]
- Multiple checkboxes in razor (using foreach)
- String interpolation in a Razor view?