forum

Home / DeveloperSection / Forums / RegisterRoutes not working in mvc5

RegisterRoutes not working in mvc5

Anonymous User 2390 20-Nov-2014

Anyone know why this is not working, i have googled it but nothing seems to work. All i want to do is allow www.abcdefg.com/username to map to a profile page but it does not work and i can't find out why.

public static void RegisterRoutes(RouteCollection routes)
        {
         routes.MapRoute(
        "Default",     // Route name
        "{controller}/{action}/{id}",   // URL with parameters
        new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
        , new { controller = @"(admin|help|profile|Settings)" } // Constraints
    );
                routes.MapRoute(
                  "Users",
                  "{username}",
                  new { controller = "Home", action = "Index", username = "" });
            }


Updated on 21-Nov-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By