Change Default Start Page Of ASP.NET MVC 4 Application
Familiarizing myself with ASP.NET MVC 4 made me think, how can I change the default start page of using global.asax? The globax.asax only has declarations
that calls methods and lacking the methods as seen in MVC 2-3 versions. Luckily, the structure of the project has been changed since the Routes have been transfered to App_Start folder. Below is the sample code to change the default start page using the the class RouteConfig.
Reference: App_start and global.asax in ASP.NET MVC 4
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //routes.MapRoute( // name: "Default", // url: "{controller}/{action}/{id}", // defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } //); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Movies", action = "Index", id = UrlParameter.Optional } ); } }
Comments
Post a Comment