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 live online training, plus books, videos, and digital content from nearly 200 publishers.