WP TutorialLesson 3Free preview
WebPages Razor
This lesson is part of ASP · All levels
Summary
Razor is a template syntax that allows server code to be written alongside HTML naturally. The @mark is used to open expressions, block codes, or directories such as @page and @{} blocks. Razor keeps HTML writing neat because it doesn't need long opening and closing tags like <% %> in Classic ASP.
Key points
- The @ sign is the main marker of server code in Razor.
- The block of code is wrapped @{}, whereas the expression is written pretty @ followed by value.
- Long expressions can be separated by @(...) so as not to collide with text.
- Directives like @page or @using set page behavior.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.