Asp.net Web Pages With — Razor Syntax

Razor automatically HTML-encodes output, which helps prevent Cross-Site Scripting (XSS) attacks.

This is the "magic" character that transitions from HTML to C#. It tells the Razor engine to start processing code instead of static text. Asp.net Web Pages With Razor Syntax

You can output values directly into your HTML, such as Current time: @DateTime.Now . Razor automatically HTML-encodes output

Razor allows you to use standard C# logic like @if , @else , and @foreach directly inside your markup. Basic Syntax Example Asp.net Web Pages With Razor Syntax