How to find the exact name of the view in asp.net mvc (including the case)

Posted by Charles Prakash Dasari on Stack Overflow See other posts from Stack Overflow or by Charles Prakash Dasari
Published on 2010-05-21T04:06:38Z Indexed on 2010/05/21 4:10 UTC
Read the original article Hit count: 156

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about c#