---
title: "RegisterRoutes not working in mvc5"  
description: "RegisterRoutes not working in mvc5"  
author: "Anonymous User"  
published: 2014-11-20  
updated: 2014-11-21  
canonical: https://www.mindstick.com/forum/12655/registerroutes-not-working-in-mvc5  
category: "asp.net mvc"  
tags: ["asp.net", "mvc5"]  
reading_time: 1 minute  

---

# RegisterRoutes not working in mvc5

[Anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-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](https://www.mindstick.com/forum/12798/there-is-no-viewdata-item-of-type-ienumerable-selectlistitem-that-has-the-key-username) to [map](https://yourviews.mindstick.com/view/81351/nepal-parliament-s-approves-new-controversial-map-india-rejects-it-but) to a [profile](https://www.mindstick.com/articles/44686/how-to-write-a-profile-essay) [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-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 = "" });            }
```

## Replies

### Reply by Anonymous User

**You must adding the default route as the last route**

## \

```
public static void RegisterRoutes(RouteCollection routes)        {         routes.MapRoute(           "Users",           "{username}",           new { controller = "Home", action = "Index", username = "" });         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    );
```


---

Original Source: https://www.mindstick.com/forum/12655/registerroutes-not-working-in-mvc5

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
