Programmer's Picnic · Learn With Champak
Razor course · Lesson 0 of 4

What is Razor?

Read the explanation, run the sample, and try the exercise.

The big idea

Razor is a server-side templating syntax that mixes HTML with C#. Razor Pages is a page-based ASP.NET Core framework; Blazor uses Razor components for interactive interfaces. These are different concepts.

A first expression

@page
<h1>Welcome!</h1>
<p>Year: @DateTime.Now.Year</p>

The server evaluates the C# expression and sends HTML to the browser.

Checkpoint

What do C#, .NET and ASP.NET Core mean? What does @ do in a Razor template?

← PreviousNext lesson →