Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , 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.
Extension 


  • 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.

1 comment:


  1. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.

    Online Reputation Management

    ReplyDelete