Razor Engine:-
  1. Razor engine represents a view engine that is used to render a Web page that uses the ASP.NET Razor syntax
  2. It is clean, lightweight and simple view engine. It is introduced with ASP.NET MVC 3 and is the default view engine moving forward
  3. Razor provides a streamlined syntax for expressing views that minimizes the amount of syntax and extra characters


Language:-
  1. Razor syntax is supported with both C# and visual basic.
  2. C# syntax are used in view files with file extension .cshtml
  3. Visual basic used in view files with file extension .vbhtml


Based upon the file extension, corresponding Razor parser is used to compile the code language.

Code expression used in Razor:-

  



            @if (price > 30)
                {
                <ol>
                @foreach(var item in Model) {
                <li>@item.ToString()</li>
                   }
                </ol>
                }




Code expression used in ASPX Syntax:-

  


  
<% if(price>30) { %>
                <ol>
                <% foreach(var item in Model) { %>
                <li><%: item.ToString() %></li>
                <% } %>
                </ol>
                <% } %>