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
2
Reply
How route table creates in MVC?
sumank
12y
26k
0
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
The RouteTable is a class that stores the URL routes for your application.A RouteCollection provides a collection of route information to be used when mapping a URI to a controller action.The RouteTable contains a property called Routes that will return a RouteCollection. The RouteTable uses a RouteCollection in order to store all the URL routing information it needs to accurately direct URI's to the correct controller action.In your global.asax you will register the routes that will map to various controller actions by specifying the following:///
/// Executed when the application starts. ///
protected void Application_Start() {RegisterRoutes(RouteTable.Routes); } Then a route will be added to the RouteCollection in the following way:///
/// Registers the routes used by the application. ///
///
Routes to register. public static void RegisterRoutes(RouteCollection routes) {routes.MapRoute("Error", "Error", new { controller = "Error", action = "Error" }); } This shows how the actual route information is stored in a RouteCollection, which in turn is referenced via the RouteTable.
Sachin Kalia
11y
1
When a MVC application first starts, the application _start() method is called. This method in turn calls RegisterRoutes() method which creates Route table.
sumank
12y
0
How to add stylesheet in view?
In MVC, is it possible to share a view across multiple controllers?
Message