How to find the exact name of the view in asp.net mvc (including the case)
- by Charles Prakash Dasari
I have a control in ASP.NET MVC that spits out JavaScript in the page header (in the view page). I derive some values from the current view name (including its case). Let's say we are talking about the path: /Home/Index - my control spits out JavaScript to call a function with the view name - in its exact case - e.g. someFunction('Index'). Now when I try to navigate to my view using '/home/index', the view name is returned as 'index' which is causing issues in my JavaScript as I rely on the casing for it on the JS side.
Is there any way to know the exact view name (as it was defined) from the path that got mapped into this view.