0

Here's my route:

    routes.MapRoute("Login", "", new { action = "Login", controller = "Authentication"})
        .DataTokens = new RouteValueDictionary(new { area = "Authentication" });

    routes.MapMvcAttributeRoutes();

Here is the controller with action:

[RouteArea("Authentication", AreaPrefix = "auth")]
[Route("{action=Login}")]
public class AuthenticationController : BaseController
{
    [HttpGet]
        [AllowAnonymous]
        public ActionResult Login()
        {
...

If I comment out routes.MapMvcAttributeRoutes(); then I can request the Login action using '/'. If its left in then this route doesn't work and I get a 404.

How do I make the default route for the website be the login page form the area?

The area is being registered independently of the attributes.

Ian Warburton
  • 15,170
  • 23
  • 107
  • 189

1 Answers1

0

I removed the convention route and added the following to <system.web> in web.config:

<urlMappings enabled="true">
      <clear />
      <add url="~/" mappedUrl="~/auth" />
    </urlMappings>
Ian Warburton
  • 15,170
  • 23
  • 107
  • 189