Function of Razor

What is the main function of Razor in ASP.NET

-Razor is a view engine that allows the static HTML or the content to be started with the server and then the content is made dynamic by adding the server code to it.

-Razor is designed to make the process of coding flexible and provide standardization.

-Razor also provides an easy way to integrate the server code into the HTML markup with few keystrokes.

-Razor is used a view engine that is very expressive in writing style. The coding becomes simpler due to the support libraries.

-Razor supports many local functions with other functionalities that help in block reading and writing. It also has pre-defined set of functions that can be used to make the coding more easier.
Post your comment


  • What is Razor? -Razor (07/15/12)
  • 2) What is Razor?

    -When we need to include our c# or VB code with the HTML markup within ASP.NET Web pages then sometimes it becomes very tedious. To overcome this problem, Razor was implemented.

    -Razor was introduced with ASP.NET MVC 3 to make ease of writing C# or VB code in HTML pages.

    -There is no need to use ASP.NET delimiter <%= %>. We can use only “@” character to achieve the same goal.

    -For example
    <%= DateTime.Now %>
    Can be written in Razor simply as

    -In razor all syntax starts with “@” and if there is only one line of code then there is no need to use “{“.

    -The extension of Razor file is cshtml for C# work environment and vbhtml for Visual Basic work environment.