There's no real value in doing this, if you want to know the user role then get the role when you need to know it, taking it from the url is a security issue. If you just want it on the url for aesthetics then something like this might help
Create a route handler
public class UserRoleHandler : IRouteHandler
{
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
string userRole = "Admin";
requestContext.RouteData.Values["role"] = userRole;
return new MvcHandler(requestContext);
}
}
and update your default route mapping as follows
routes.MapRoute(
name: "Default",
url: "{role}/{controller}/{action}/{id}",
defaults: new { role = "User", controller = "Home", action = "Index", id = UrlParameter.Optional }
).RouteHandler = new UserRoleHandler();
We've put the role parameter first, but the custom UserRoleHandler will ensure the role value is whatever role the user is in rather than what is on the url. So even if someone manually changes "User" to "Admin" the role value will still be User if that's what they are.
The above is MVC 5, you might need to adjust as necessary if you're not using 5.
Update
The original route won't work with this config, if you want the traditional "controller/action" route to work you might want to try something like
routes.MapRoute(
name: "Default",
url: "Account/{role}/{controller}/{action}/{id}",
defaults: new { role = "User", controller = "Home", action = "Index", id = UrlParameter.Optional }
).RouteHandler = new UserRoleHandler();
routes.MapRoute(
name: "Traditional",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
The issue with multiple routes like above is that when generating urls if you want to specifically have the standard url pattern you need to specify you want to use the "Traditional" route. The alternative is that you leave the default as it is and use the one with the role as the non-default, but then any time you want a url in that format you'll need to choose the relevant route name when generating it.