MVC Developer Question:

Tell us what is Route in MVC? What is Default Route in MVC?

Tweet Share WhatsApp

Answer:

A route is a URL pattern that is mapped to a handler. The handler can be a physical file, such as a .aspx file in a Web Forms application. A handler can also be a class that processes the request, such as a controller in an MVC application. To define a route, you create an instance of the Route class by specifying the URL pattern, the handler, and optionally a name for the route.

You add the route to the application by adding the Route object to the static Routes property of the RouteTable class. The Routesproperty is a RouteCollection object that stores all the routes for the application.

You typically do not have to write code to add routes in an MVC application. Visual Studio project templates for MVC include preconfigured URL routes. These are defined in the Mvc Application class, which is defined in the Global.asax file.

Download MVC Developer PDF Read All 50 MVC Developer Questions
Previous QuestionNext Question
Explain me what is Areas in MVC?Tell me is it possible to share a view across multiple controllers?