asp.net mvc3, Authorize attribute redirects to wro

2019-07-28 04:30发布

I have a page that needs to be secured. I add [Authorize] attribute to that action method. if you are not logged in, you will be redirect to the login page everytime you visit that secure page.

it works except I rename logon action to login , but applicaiton still redirects user to logon action. its no long there, I rename it, how do I fix it?

2条回答
女痞
2楼-- · 2019-07-28 04:46

In your Web.config file change the forms loginUrl.

<authentication mode="Forms">
  <forms loginUrl="~/Controller/Action" />
</authentication>
查看更多
Juvenile、少年°
3楼-- · 2019-07-28 04:58

You need to set the loginUrl in the <forms /> element in Web.config.

查看更多
登录 后发表回答