asp.net-mvc Razor

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

What is Razor?

Razor is a markup syntax that lets you embed server-based code (Visual Basic and C#) into web pages.

Server-based code can create dynamic web content on the fly, while a web page is written to the browser. When a web page is called, the server executes the server-based code inside the page before it returns the page to the browser. By running on the server, the code can perform complex tasks, like accessing databases.

Syntax

  • @{ ... }
  • @variableName
  • @(variableName)
  • @for(...){ }
  • @(Explicit Expression)
  • @* comments *@

Remarks

ASP.NET Razor includes view engines for both C# and VB.

The C# view engine processes files with a .cshtml extension, while the VB view engine works with .vbhtml files.



Got any asp.net-mvc Question?