Dot Net Stuff

Understanding Routing in ASP.NET MVC with example

Routing in Asp.NET MVC is how ASP.NET MVC matches a URI to an action. ASP.NET routing enables you to use URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs that are descriptive of the user's action and therefore are more easily understood by users. It is a part of all the MVC versions but MVC 5 supports a new type of routing, called attribute routing. As the name implies, attribute routing uses attributes to define routes. Attribute routing gives you more control over the URIs in your web application. There is a separate article to understand Attributes in Routing in ASP.NET MVC.

Continue Reading>>

Understand ASPX and Razor View Engine

ASP.NET MVC is one of the most popular frameworks for these days and the term “View Engine” is belongs to that. I this section we are try to understand about Razor View Engine and ASPX View Engine.


Introduction of View Engine

There are two types of view engine supported by ASP.NET MVC. In this Article we will go through the Razor and ASPX view engine View Engines are responsible for rendering the HTML from your views to the browser. The view engine template will have different syntax for implementation.

What is @Razor ?

Razor using an @ character instead of aspx's <% %> and Razor does not require you to explicitly close the code-block, this view engine is parsed intelligently by the run-time to determine what is a presentation element and what is a code element. Razor view engine is compatible with unit testing frameworks. This is the default view engine in MVC 3 and MVC 4. Web pages with Razor syntax have the special file extension cshtml (Razor with C#) or vbhtml (Razor with VB).

Continue Reading>>