CHAPTER 6

The Razor Syntax

A man should stand up to his bad luck, to his mistakes, to his conscience and all that sort of thing. Why—what else would you have to fight against?

—Joseph Conrad, “The Shadow Line”

An ASP.NET Core application is typically, but not necessarily, made of controllers, and controller methods typically, but not necessarily, return ViewResult objects as the result of their action. The action result is then processed by the action invoker system component to produce the actual response. If the action result is a ViewResult object, the view engine is kicked off to produce some HTML markup. The view engine is architected to consume templates from a given folder structure and fill it out with some provided data. The way templates ...

Get Programming ASP.NET Core, First edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.