Users Pricing

forum

home / developersection / forums / registerroutes not working in mvc5

RegisterRoutes not working in mvc5

Anonymous User 2682 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 = "" });
            }


I am a content writter !


1 Answers