Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP.NET Razor Markup

ASP.NET Razor - Markup


Razor is not a programming language. It is a server-side markup language.


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 when the page is delivered to the browser. When a page is requested, the server executes the server-based code in the page before returning it to the browser. By running on the server, the code can perform complex tasks, such as accessing a database.

Razor is based on ASP.NET and is designed for creating web applications. It has the functionality of traditional ASP.NET but is easier to use and easier to learn.


Razor syntax

Razor uses a syntax similar to PHP and classic ASP.

Razor:

PHP:

Web Forms (classic ASP):


Razor Helpers

ASP.NET helpers are components accessible with just a few lines of simple Razor code.

You can build your own helpers using Razor syntax, or use the built-in ASP.NET helpers.

Below are brief descriptions of some useful Razor helpers:


Razor Programming Language

Razor supports C# (C sharp) and VB (Visual Basic).