ASP.NET Razor - Markup

Razor isn't a programming language. It's a server side markup language.

What is Razor?

Razor is a markup linguistic structure that gives you a chance to implant server-based code (Visual Basic and C#) into web pages.

Server-based code can make dynamic web content on the fly, while a website page is kept in touch with the program. At the point when a website page is called, the server executes the server-based code inside the page before it restores the page to the program. By running on the server, the code can perform complex undertakings, such as getting to databases.

Razor is based on ASP.NET, and structured for making web applications. It has the intensity of customary ASP.NET markup, in any case, it is simpler to utilize, and less demanding to learn.

Razor Syntax

Razor utilizes a language structure fundamentally the same as PHP and Classic ASP.


@for (int I = 0; I < 10; i++) {


for ($i = 0; $i < 10; $i++) {

Web Forms (and Classic ASP):

<% for (int I = 0; I < 10; i++) { %>
<li><% =i %></li>
<% } %>

Razor Helpers

ASP.NET assistants are segments that can be gotten to by single lines of Razor code.

You can construct your own partners utilizing Razor linguistic structure, or utilize worked in ASP.NET helpers.

Below is a short portrayal of some valuable Razor helpers:

  • Web Grid
  • Web Graphics
  • Google Analytics
  • Facebook Integration
  • Twitter Integration
  • Sending Email
  • Validation

Razor Programming Languages

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