Razor is a markup syntax for adding server-based code to a Web page
Razor is not programming and language. It is a service-side markup language.
When a Web page is written to the browser, the server-based code can create dynamic content. When the Web page loads, the server executes the server-based code within the page before returning the page to the browser. Because it is running on a server, this code can perform complex tasks, such as accessing a database.
Razor is based on ASP. NET, which is designed for the creation of WEB applications.
Razor has the ability to have traditional ASP. NET tags, but it's easier to learn and easier to use
Razor is a server-side markup syntax similar to ASP and PHP
Razor support for C # and Visual Basic programming languages
Advantages:
#Razor syntax is simple and clear, requiring only minimal input
#Razor Easy to learn, syntax similar to C # and VB
#Visual Studio provides smart hints and syntax coloring for Razor
#Razor view does not need to allow programs or start a Web server to test
New features:
- @model used to specify the model type to upload to the view
- @* * comment syntax
- For the entire site, you can set default items, such as layouts, at once.
- The Html.raw method provides output that is not HTML -encoded
- Support for sharing code between multiple views (_viewstart.cshtml or _viewstart.vbhtml)
The Razor also contains new HTML helpers, such as:
- Chart. Generate chart
- WebGrid, generating data tables to support full pagination and sorting
- Crypto, use hash algorithm to create hash and salt-adding passwords
- Webimage, creating pictures
- WebMail, send e-mail
ASP (a) what is razor