given a mvc4 which has a {sitename} parameter in the routes like so
routes.MapRoute(
"Sites", // Route name
"{sitename}/{controller}/{action}/{id}", // URL with parameters
new { sitename = "", controller = "Home", action = "Index", id = "" } // Parameter defaults
);
and all is working well except AccountController and any other which use the [Authorize] attribute as the redirect goes to
~/Account/Login
rather than
~/{sitename}/Account/Login
for consistency and aesthetics as well
Is there a way to change this ? The obvious answer is to create a custom AuthorizeAttribute but most examples such as the answer to ASP.NET MVC 4 custom Authorize attribute - How to redirect unauthorized users to error page? simply call
base.HandleUnauthorizedRequest();
so looking for any help before i tried the code/debug/code/debug route !