TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
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
Forums
Monthly Leaders
Forum guidelines
Prasad Krishnarao
NA
582
16k
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