Watch Pre-recorded Live Shows Here
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Prasad Krishnarao
1.6k
569
13.5k
Routing in ASP.Net MVC - Default
Oct 15 2019 12:50 PM
Hello
If I run the application without Controller name and Action Name, I am expecting the Default Route (Index Action) should be executed.
But in my scenario, the Application calls the Contact Action (the first Route). Is that correct?
Could you please explain to me?
URL: https://localhost:43350/
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "about",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Contact", Id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
Reply
Answers (
2
)
read json file data and insert bulk data
application used to find a particular number in a log file