Yes, this is a newbie question and might be ridiculous, but I'm apparently having tremendous difficulty finding an answer to get up and running.
I've created an ASP.NET Razor (v3) web site using the Visual Studio template. That's fine and I can see everything locally. However, when I try to view the Default.cshtml page on the server I get this error:
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: /4.6.1Razor/Default.cshtml
My server administrator says this: You are not supposed to access a cshtml file directly on a production server, it’s blocked by default. Please access an html, htm, asp or aspx file and use that to get the data from the cshtml.
Okay ... so how exactly do I access a cshtml file via an aspx file? Or can someone point me to a working sample that I can look at?
The default files that Visual Studio created did not include an html, htm, asp, or aspx file so I'm a little confused as to how to start that. Also, the samples that Visual Studio points to are of course broken: http://www.asp.net/aspnet/samples/aspnet-web-pages.
A little help pointing me to the right direction would be appreciated. Thanks.
Maybe the question should be ... What kind of page / file (.asp or .aspx or what) do I need to render a .cshtml file and how do I do that. I've tried a .aspx file with the code: @RenderPage("Default.cshtml") but when I view the file in a browser it just echoes @RenderPage("Default.cshtml") instead of rendering anything.