mg3
mg3

Reputation: 131

MVC - navigate to home on application start

i added the following routes in my routetable.

routes.MapRoute(
            "Default",                                             
            "{controller}.aspx/{action}/{id}",                      
            new { action = "Index", id = "" } 
        );

        routes.MapRoute(
            "Root",    
            "",        
            new { controller = "Home", action = "Index", id = "" } 
        );

        routes.MapRoute(
            "Home",                                                 
            "Index",                                         
            new { controller = "Home", action = "Index", id = "" }  
        );

and i can navigate to the home page (manually). But the application will not navigate on app start.

Any ideas? Thanks.

Upvotes: 0

Views: 377

Answers (1)

c0demaster
c0demaster

Reputation: 740

this code block would work just changed router name

routes.MapRoute(
        ".netx",
        "{controller}.aspx/{action}/{id}",
        new
        {
            action = "Index",
            id = ""
        });


        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

and please be sure on the application start page

and please be sure on the application start page

Upvotes: 1

Related Questions