Bhabani Prasad
What are routing in MVC?
By Bhabani Prasad in ASP.NET MVC on May 23 2014
  • Akhilesh Pandit
    May, 2015 1

    sically, Routing is a pattern matching system that monitor the incoming request and figure out what to do with that request. At runtime, Routing engine use the Route table for matching the incoming request's URL pattern against the URL patterns defined in the Route table. You can register one or more URL patterns to the Route table at Application_Start event. MVC5 also supports attribute routing, to know more refer Attribute Routing in ASP.NET MVC.

    • 2
  • Naresh
    Dec, 2014 2

    Routing Matches incoming request to the specific action method

    • 1
  • Bhabani Prasad
    May, 2014 23

    • Routing helps you to define a URL structure and map the URL with the controller. • For instance let's say we want that when any user types “http://localhost/View/ViewCustomer/”, it goes to the “Customer” Controller and invokes “DisplayCustomer” action. • This is defined by adding an entry in to the “routes” collection using the “maproute” function. Below is the under lined code which shows how the URL structure and mapping with controller and action is defined. routes.MapRoute("View", // Route name"View/ViewCustomer/{id}", // URL with parametersnew { controller = "Customer", action = "DisplayCustomer", id = UrlParameter.Optional }); // Parameter defaults

    • 1
  • Sunil Babu
    Apr, 2016 2

    Routing is a feature provided in MVC in which we can do URL rewriting,set a url format for calling an action/view and do default setting of page url.

    • 0
  • Sanjib Barik
    May, 2015 20

    Routing is a pattern matching mechanism of incoming requests to the URL patterns which are registered in route table. Class – “UrlRoutingModule” is used for the same process.

    • 0
  • Jagan Mohan
    Jul, 2014 16

    A route is a URL pattern that is mapped to a handler. The handler can be a physical file, such as an .aspx file in our web application. Routing module is responsible for mapping incoming browser requests to particular MVC controller actions.When you create a new ASP.NET MVC application, the application is already configured to use ASP.NET Routing. ASP.NET Routing is setup in two places. First, ASP.NET Routing is enabled in your application's Web configuration file (Web.config file). There are four sections in the configuration file that are relevant to routing: 1) the system.web.httpModules section, 2) the system.web.httpHandlers section, 3) the system.webserver.modules section, and 4) the system.webserver.handlers section. Be careful not to delete these sections because without these sections routing will no longer work. Second, and more importantly, a route table is created in the application's Global.asax file. The Global.asax file is a special file that contains event handlers for ASP.NET application lifecycle events. The route table is created during the Application Start event.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.

    • 0
  • mahmood ahmad
    Jun, 2014 17

    • Routing helps you to define a URL structure and map the URL with the controller. • For instance let's say we want that when any user types “http://localhost/View/ViewCustomer/”, it goes to the “Customer” Controller and invokes “DisplayCustomer” action. • This is defined by adding an entry in to the “routes” collection using the “maproute” function. Below is the under lined code which shows how the URL structure and mapping with controller and action is defined. routes.MapRoute( "View", // Route name "View/ViewCustomer/{id}", // URL with parameters new { controller = "Customer", action = "DisplayCustomer", id = UrlParameter.Optional }); // Parameter defaults

    • 0
  • Rahul Rao
    Jun, 2014 7

    Routing is a pattern matching system that monitor the incoming request and figure out what to do with that request. At runtime, Routing engine use the Route table for matching the incoming request's URL pattern against the URL patterns defined in the Route table. You can register one or more URL patterns to the Route table at Application_Start event.

    • 0
  • Nayeem Mansoori
    Jun, 2014 4

    Routing is the URL pattern that is mappped together to a handler,rounting is responsible for incomming browser request for perticuler MVC controller.In other ways lets say routing help you to define a URL structure and map the URL with controller. There are three segment for routing it is very important that is > 1)ControllerName 2)ActionMethodName 3)Parammeter i.e : ControllerName/ActionMethodName/{ParamerName}And also rout map coding written in a Global.asax file.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS