programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Thursday, March 10, 2016

Differences Between Razor and ASPX View Engine in MVC

Differences Between Razor and ASPX View Engine in MVC:

View Engine renders the view into HTML form to the browser. If we talk about a MVC application in the .Net Framework, it supports the following 2 view engines:
  1. Razor View Engine
  2. Web Form/Aspx View Engine

Differences between Razor And ASPX View Engin:

  1. Entry with ASP.NET MVC
    • Razor View Engine is an advanced view engine and introduced with MVC3. This is not a language but it is a markup syntax.
    • ASPX View Engine is the default view engine for the ASP.NET MVC that is included with ASP.NET MVC from the beginning.
  2. Namespace

    • Razor View Engine supports System.Web.Razor.
    • ASPX View Engine supports System.Web.Mvc.WebFormViewEngine.

  1. Layout /MasterPage
    • In Razor View Engine we use Layouts.
    • In ASPX View Engine we use masterPages.

PartialPage /WebUserControl

  • In Razor View Engine we use PartialPage.
  • In ASPX View Engine we use WebUserControls.

  • Razor View Engine has .cshtml (with C#) and .vbhtml (with VB) extension for views, Layout and Partial views.
  • ASPX View Engine has a similar extension as in a simple web application like .aspx for the views, .acsx for UserControls and .master for Master Pages.
  • Performance

    • Razor Engine is a little slow compared to Aspx Engine.
    • Aspx Engine is faster compared to Razor Engine.

  • Syntax

    • ‘@’ symbol uses in Razor Engine to write the code. @Html.ActionLink("Login", "LoginView")
    • ‘<%:’ delimiters use as starting point and ‘ %>’ use as ending point. You can write the code between them in ASPX Engine.
<%: Html.ActionLink("Login ", " LoginView ") %>  

Cross-Site Scripting Attacks

  • Razor Engine prevents Cross-Site Scripting Attacks, in other words it encodes the script or HTML tags like <,> before rendering to view.
  • ASPX Engine does not prevent Cross-Site Scripting Attacks, in other words any script saved in the database will be fired while rendering the page.