Who's Online
6 visitors online now
1 guests, 5 bots, 0 members
Support my Sponsor

Posts Tagged ‘web form’

Getting started with MVC ASP .NET – Part 2

Hello Everyone,

In my previous blog , I tried to explain basic details related to MVC Framework.

Now, I would like to share detailed view of RAZOR engine , ASPX engine and various file and folder in shown in Solution Explorer.

What is RAZOR and ASPX ?

Razor as well as ASPX  are View Engine. View Engine are responsible for rendering view into HTML  form to browser.  MVC supports both Web Form(ASPX) as well as Razor. Now, Asp.net MVC is open source and can work with other third party view engines like Spark, Nhaml.

What are difference between in RAZOR and Web Form(ASPX)?

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.
The namespace for Razor Engine is System.Web.Razor. The namespace for Webform(ASPX) Engine is System.Web.Mvc.WebFormViewEngine.
It has .cshtml with C# or .vbhtml with VB extension for views, partial views, editor templates and for layout pages. It has .aspx extension for views, .ascx extension for partial views & editor templates and .master extension for layout/master pages.
RAZOR is much easier and cleaner than Web Form. It uses @ symbol in coding.
e.g.@Html.ActionLink(“Test”, “Test”)
ASPX Uses <% and %> delimiter in coding.
e.g. <%: Html.ActionLink(“Test”, “Test”) %>
RAZOR engine comparatively slow but provides better security than ASPX.Razor Engine prevents XSS attacks(Cross-Site Scripting Attacks) means it encodes the script or html tags like <,> before rendering to view. Web Form is comparatively faster but less secure than RAZOR.Web Form Engine does not prevent XSS attacks means any script saved in the database will be fired while rendering the page
Razor Engine, doesn’t support design mode in visual studio means you cannot see your page look and feel without running application. Web Form engine support design mode in visual studio means you can see your page look and feel without running the application.
Razor Engine support TDD (Test Driven Development) since it is not depend on System.Web.UI.Page class. Web Form Engine doesn’t support TDD (Test Driven Development) since it depend on System.Web.UI.Page class which makes the testing complex.


What are different file and folder in MVC application.

MVC has default folder structure as show in below figure.MVC Framework follows naming conventions such as model will be in model folder, controller will be in controller folder, view will be in folder and so on. This naming method reduces code and makes easy for developer to understand the architecture.

The App_Data is used for storing application data.

The Content folder is used for static files like style sheets, themes, icons and images.

The Controllers folder contains the controller classes responsible for handling user input and responses.

The Models folder contains the classes that represent the application models. Models hold and manipulate application data.

The Views folder stores the HTML files related to the view of the application.The Views folder contains one folder for each controller and shared folder. The Shared folder is used to store views which is shared among the application like _Layout.cshtml.

The Scripts folder stores the JavaScript files of the application.

For more details you can visit here.

I hope this will help you.

Your valuable feedback and comments are important for me.