What is the difference between cshtml and html?

1

Is there any difference between CSHTML and HTML , mainly in security, performance, and application? Is there a loss when using HTML in an ASP MVC project, and what are the benefits of using CSHTML in a project? >     

asked by anonymous 10.11.2017 / 23:25

1 answer

4

CSHTML is a file (.cshtml, c-sharp html extension) that has HTML tags but differs from it by containing , which is a view engine of ASP.NET MVC and WebMatrix applications, and run on the server using the C # language. This extension (.cshtml) only indicates that the file contains the Razor syntax in the C # language that will be interpreted by the server, and like in other server-side languages, the return is pure HTML. >

Differences in security, performance, and enforcement between the two things is quite obvious, and if we were to list all the differences, it would give a book. An HTML page, roughly speaking, is just a page with tags and scripts that just run on the client-side (interpreted by browser) and can be altered in the client-side as well. CSHTML accepts server-interpreted codes (as explained at the beginning). With this basic notion between the two things, it is already possible to have a notion of application, performance and, mainly, security.

Regarding using HTML in ASP MVC, it does not make much sense. You do not need an advanced environment (ASP MVC) to create simple HTML pages. But that will depend a lot on your project. If you intend to use CSHTML, you are assumed to have a project that will make good use of this feature. Generally, in order to choose a programming language and server resources, it is necessary first to draw a scope of the project that one wants to develop. Often one chooses a cannon to kill a rabbit. The benefits, in my view, are relative, it will depend on your project allied with the features you intend to use on it.

The page on this link is a good take on the subject.

    
11.11.2017 / 01:09