MVC 3 default register link not work [duplicate]

2019-09-21 16:50发布

问题:

Possible Duplicate:
MVC Forms LoginUrl is incorrect

I have deployed the simple mvc 3 to IIS 7.5. The register redirect url is /Account/LogOn?ReturnUrl=%2fAccount%2fRegister. It does not redirect to registration web page.

It seems like the Logon problem as the thread: MVC Forms LoginUrl is incorrect

回答1:

From ASP.NET MVC 3 Release Notes :

There’s a known issue that causes Forms Authentication to always redirect unauthenticated users to ~/Account/Login, ignoring the forms authentication setting used in Web.config. The workaround is to add the following app setting.

<add key="autoFormsAuthentication" value="false" />

Check yourself out :

http://www.asp.net/learn/whitepapers/mvc3-release-notes#0.1__Toc274034230



回答2:

What comes to mind is if you have checked if your register method is without the AuthorizeAttribute? Maybe you've put the AuthorizeAtrtribute on top of the controller or you you've created a BaseController with the attribute, so every controller deriving from it need the user to be authenticated