How can I get the current view name regarding to current URL, in asp.net MVC 3 using Razor engine?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No idea why you would need to get the current view name but you could use the
VirtualPathproperty inside a view. Normally it’s more useful to know the current action or controller. But anyway, here’s how to get the current view name:and if you wanted to get only the filename:
and without the extension: