How exactly does one render a .cshtml
file?
I'm new to ASP.NET. I've created an MVC project using Visual Studio's template. Apparently all the templates have .cshtml
for the Default / Index files. But my server gives me this error when I try to view it:
Server Error in '/' Application. This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /mobile/WebApplication1/Index.cshtml
So, how exactly do I view the Index file? Do I need to pass it through something to convert to .html
or render it somehow?
/mobile/WebApplication1/Index
/mobile/WebApplication1/
bit from? If the cshtml is inViews/Home
, you just need to writelocalhost/Index