Click here to Skip to main content
15,902,492 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

In a MVC model pattern what happens when no controller name is specified in the URL, for What happens after this URL is given in browser ?
how will it route to the default one..where does this happens in the application ?

1 solution

Your routeconfig will have code like

    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

This means that if no controller is given then use Home and if no action then use Index. So "/" uses "/Home/Index", and "/MyController" will use "/MyController/Index"
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900