MVC Routing

MVC Routing is used to simplify MVC URLs. Mapping user-friendly URLs to action names in the controller.

You can also read Model-View-Controller (MVC)

Routing

When you create a new MVC application and the MVC application is already configured to use routing. There are two places setup of routing one is Web configuration file (Web.config file) and the second one is applications Global.asax file. Web configuration files having four sections that are relevant to routing these are the first one is system.web.httpModules, the second one is system.web.httpHandlers, the third one is system.webserver.modules and the fourth one is system.webserver.handlers.

MVC Routing is used to simplify MVC URLs. Mapping user-friendly URLs to action names in the controller. Default is the last statement because else it bypasses the other URLs from the route which you defined. Routing is a collection and has unique names or keys in the collection. Also, there is another way to create a table in SQL server with name, URL name, Controller name, and action name.

How to start page in MVC- in MVC there is no start page because the first hit always comes to the controller. For that, you have to set the start controller and start the action and in routing, you have to set nothing means it serves as start page.

How does MVC Routing work?

In the above image is the routing engine structure and you can see how MVC Routing works and what result they send?

When you request on registered route patterns for matched URL then request forwards to the suitable handler and after that URLs, the result is processed and you get a view on the UI. When you request on registered route patterns for not matched URL then routing could not request to the handler and it gets the error that is HTTP 404 Error.

Routing importance

Ignoreroute is not allowed you to download config or axd files.

Routing is helpful for search engine optimization.

You can also read Model-View-Controller (MVC)

Suchandra Karle

Suchandra Karle is Sr. Software Engineer. Working in Software Company. He is having more than seven years of experience. Other than work he have hobby to write a blog and trading and playing computer games.

6 thoughts on “MVC Routing

  1. Awesome write-up. I’m a normal visitor of your web site and appreciate you taking the time to maintain the excellent site. I will be a regular visitor for a really long time.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top