ASP.NET Razor - mark

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

What's Razor?

Razor is a markup syntax that allows you to embed server-based code (Visual Basic and C #) to the page.

When the page is written to the browser, server-based code to create dynamic content. When the page is loaded, the server before the page is returned to the browser, server-based code is executed within the page. Because it is running on the server, this kind of code can perform complex tasks, such as database access.

Razor-based ASP.NET, which creates web applications for design. It has the ability to mark the traditional ASP.NET, but easier to use, and easier to learn.

Razor Syntax

Razor syntax similar to that used with PHP and ASP.


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


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

Web Forms (as well as Classic ASP):

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

Razor Helper

Razor Helper can be accessed through a simple Razor code.

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

Here are some important Razor helper brief description:

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

Razor programming language

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