5
Reply

What is the adavantage of using ASP.NET routing?

Bhabani Prasad

Bhabani Prasad

10y
4.8k
0
Reply

    • In an ASP.NET web application that does not make use of routing, an incoming browser request should map to a physical file. If the file does not exist, we get page not found error. • By using Routing, it will make use of URLs where there is no need of mapping to specific files in a web site..

    ASP.net has a feature of routing which is used for url rewriting.This saves space as we are not using external dll or are writing a dll for url rewriting. Limiting use of HTTP handlers and HTTP modules.

    It Supports ASP.Net Routing which provides better URL (Universe Resource Locator) Mapping in Our MVC Applications. In ASP.NET routing URL can be very useful for Search Engine Optimization (SEO) and Representation State Transfer (REST).Routing: The messages are routed to the server for making the delivery of the request easier and provide the URL Mapping.Routing is a stand-alone component that matches incoming requests to IHttpHandlers by URL pattern. MvcHandler is, itself, an IHttpHandler, which acts as a kind of proxy to other IHttpHandlers configured in the Routes table.

    Here is why Routing in MVC : http://www.c-sharpcorner.com/UploadFile/56fb14/working-with-routes-in-mvc-framework/

    1) In normal ASP.NET, the physical file location must be match with the URL. If file not present then it will give error 404 page not found. By using Routing their is no need to file physically present to that location, if file not present in directory then browser searches in whole project directory. 2) By using routing, if we call to the only controller then it automatically called to particular Index related to that controller. 3) Default ASP.NET MVC routes is defined in the Global.asax file, as routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults );