What is CSHTML

It is an HTML file that also renders ASP.net modules – creating dynamic code and making the HTML more of a template.  It provides handler mapping and will load the MVC engine.

The CSHTML extension tells ASP.net that there is code on that page that needs to be executed using the Razor view engine inside of ASP.net.

The markup is a “@” symbol followed by the variables or the code that needs to be executed.

If you’ve ever seen classic ASP.net calls like <% …. %> then basically the Razor syntax replaces those characters with a simple @ symbol

– it is cleaner and saves some typing.

There are some other examples of the MVC engine with .vbhtml or the .aspx extension

Great article with examples

 

You may also like...