C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
12
Reply
Explain Routing in MVC
Amita Palkar - Junnarkar
7y
5.1k
3
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
Hello Friends, Lets learn about how routing works MVC framework. Each and every application has routing mechanism inside framework when request come from browser to application.Having said that let's understand how routing mechanism built in MVC (Model View Controller) .Step by Step explanation.1. RequestUser makes request from browser to the mvc app. Request should have controller name and action name and id is optional. Ex. http://servername:port/controller/action2. RoutingRequest will be validated with Route table which will have collection of routes defined in application (controller name and action name). If the received request doesn't match returns 404 Not found error else handovers the request to next step.3. MVC InitializerMVC intializer will gets the request and creates the instance of respective controller and passes request to controller.4. ControllerOnce controller receives the requests it executes the respective action method.5. Action Executionaction method will inturn communicates with Business Layer -> Data Access Layer and get the data and passed to View Engines.6. View EngineIts responsibility to prepare the data based on return types (JsonResult, JavaScriptResult etc) and sends to View Result7. ViewResultGets the data from View Engines and sends to respective view to render on the browser.8. ViewRenders the result on specified view9. ResponseUser gets required data on browser page as response.Thanks for your time and reading the article.I hope its very clear to read and understand. If you have any question please reply.
Mahesh Pattar
7y
6
Hello Friends, Lets learn about how routing works MVC framework. Each and every application has routing mechanism inside framework when request come from browser to application.Having said that let's understand how routing mechanism built in MVC (Model View Controller) .Step by Step explanation.1. RequestUser makes request from browser to the mvc app. Request should have controller name and action name and id is optional. Ex. http://servername:port/controller/action2. RoutingRequest will be validated with Route table which will have collection of routes defined in application (controller name and action name). If the received request doesn't match returns 404 Not found error else handovers the request to next step.3. MVC InitializerMVC intializer will gets the request and creates the instance of respective controller and passes request to controller.4. ControllerOnce controller receives the requests it executes the respective action method.5. Action Executionaction method will inturn communicates with Business Layer -> Data Access Layer and get the data and passed to View Engines.6. View EngineIts responsibility to prepare the data based on return types (JsonResult, JavaScriptResult etc) and sends to View Result7. ViewResultGets the data from View Engines and sends to respective view to render on the browser.8. ViewRenders the result on specified view9. ResponseUser gets required data on browser page as response.Thanks for your time and reading the article.I hope its very clear to read and understand. If you have any question please reply.
Mahesh Pattar
7y
3
http://www.tutorialsteacher.com/mvc/routing-in-mvc
Aniket Rana
7y
3
Basically, Routing is a pattern matching system that analyzes the incoming request and figures out what to do with that request. At runtime, Routing engine uses the Route table for matching the incoming request URL pattern against the URL patterns defined in the Route table. You can register one or more URL patterns in the Route table at Application_Start event of your project. When the routing engine finds a match in the route table for the incoming request URL, it forwards the request to the appropriate controller and action. If there is no match found in the route table for the incoming request URL, it returns a 404 HTTP status code that means "Page Not Found".
Deepak Verma
7y
2
Hello Friends, Lets learn about how routing works MVC framework. Each and every application has routing mechanism inside framework when request come from browser to application.Having said that let's understand how routing mechanism built in MVC (Model View Controller) .Step by Step explanation.1. RequestUser makes request from browser to the mvc app. Request should have controller name and action name and id is optional. Ex. http://servername:port/controller/action2. RoutingRequest will be validated with Route table which will have collection of routes defined in application (controller name and action name). If the received request doesn't match returns 404 Not found error else handovers the request to next step.3. MVC InitializerMVC intializer will gets the request and creates the instance of respective controller and passes request to controller.4. ControllerOnce controller receives the requests it executes the respective action method.5. Action Executionaction method will inturn communicates with Business Layer -> Data Access Layer and get the data and passed to View Engines.6. View EngineIts responsibility to prepare the data based on return types (JsonResult, JavaScriptResult etc) and sends to View Result7. ViewResultGets the data from View Engines and sends to respective view to render on the browser.8. ViewRenders the result on specified view9. ResponseUser gets required data on browser page as response.Thanks for your time and reading the article.I hope its very clear to read and understand. If you have any question please reply.
Mahesh Pattar
7y
2
Hi Friends, Routing is the concepts which help the user to move from one view to another . In MVC We have RouteConfig.cs within the APP Start folder which maintain the routing in MVC. Fo example when user request any page from the browser by enter the url then the routeconfig will match the route using map.route . Here Default Route and specified route details which work according to Controller name and Action method name . The parameter either optional or mandatory which we will define during routing creation.
Bhairab Dutt
7y
1
ASP.NET routing was initially launched as MVC routing to support clean URL semantics for sites built on ASP.NET MVC. However, it was later pushed up in the framework to become a part of ASP.NET core and thus available for WebForms as well. In this article, we look at how routes work and how you can use them in your MVC web application to expose functionality in a transparent and discoverable way.
Sankara Krishnan Venugopal
7y
1
Atleast one routing path is defined by MVC framework. You can register a route in RouteConfig class, which is in RouteConfig.cs under App_Start folder.Route is configured using the MapRoute() extension method of RouteCollection, where name is "Default", url pattern is "{controller}/{action}/{id}" and defaults parameter for controller, action method and id parameter. Defaults specifies which controller, action method or value of id parameter should be used if they do not exist in the incoming request URL.After configuring all the routes in RouteConfig class, you need to register it in the Application_Start() event in the Global.asax.
Amit Kumar Agrawal
7y
1
https://www.c-sharpcorner.com/UploadFile/3d39b4/routing-in-mvc/
Satish Kumar Vadlavalli
7y
1
In the ASP.NET Web Forms application, every URL must match with a specific .aspx file. For example, a URL http://domain/studentsinfo.aspx must match with the file studentsinfo.aspx that contains code and markup for rendering a response to the browser. Route Route defines the URL pattern and handler information. All the configured routes of an application stored in RouteTable and will be used by Routing engine to determine appropriate handler class or file for an incoming request. Configure a Route Every MVC application must configure (register) at least one route, which is configured by MVC framework by default. You can register a route in RouteConfig class, which is in RouteConfig.cs under App_Start folder.
Abhijit Sahoo
7y
0
Basically, 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
Shivam Shukla
7y
0
MVC routes are initialized at RouteConfig.cs with RegisterRoutes method, where we are accessing the configuration at Application_Start in global.asax file.
Sreekanth Reddy
7y
0
Message