Forms Authentication loginUrl ignored

I hit this issue a while back, and someone else just tripped up on it so thought it was worth posting here. If you’ve got loginUrl in your Forms Authentication configuration in web.config set, but your ASP.NET Forms or MVC app has suddenly started redirecting to ~/Account/Login for no apparent reason, then the new simpleMembership(ish) provider is getting in the way. This seems to happen after updating the MVC version, or installing .NET 4.5.1 at the moment.

Try adding the following to your appSettings in the web.config file:

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

which resolved the issue for me. Still trying to figure out with Microsoft why this is an issue.

2 thoughts on “Forms Authentication loginUrl ignored”

  1. During an entire day of meditative debugging I found, that the reason of such weird behavior is WebMatrix.dll and WebMatrix.Data.dll. Even this libraries are NOT REFERENCED by any project in solution and just lies in ‘bin’ folder, they injects SimpleMembership in Asp.NET pipeline causing this error.

  2. If you do want simple membership, instead of turning it off, add another appSettings element, with attributes key=”loginUrl” and value=”–your login Url–“.

    Seems simplemembership ignores the authentication/forms loginurl attribute.

    Credit to matthew29 at http://forums.asp.net

Leave a Reply

Your email address will not be published. Required fields are marked *