0

I have in my routeconfig route:

routes.MapRoute(name: "Login", url: "login", defaults: new { controller = "Account", action = "Login" });

It works fine except when the user is not authorized and calls a function with [Authorize] he is redirected to account/login, but not to /login as it should. Can you give me please an idea how to fix this issue?

CodeDemen
  • 1,841
  • 3
  • 17
  • 30

1 Answers1

2

Url of login page you set in web.config:

    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>

You should change it here. RouteTable is about mapping of incoming urls to controllers and actions.

Kirill Bestemyanov
  • 11,946
  • 2
  • 24
  • 38