views:

35

answers:

2

I'm attempting to upgrade an MVC project to Beta using Razor (from the Preview release) and am now experiencing strangeness with Razor not going to my login view that it use to go to (when someone asks for an action that required authorization).

My web config has

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

But whenever an action with the Authorize attribute is hit, the browser redirects to "Account/Login" - notice Log*in* NOT Log*On*. Anyone know how to fix this in MVC 3 Beta?

A: 

Try adding the following the <configuration> section of your application's Web.config file:

<appSettings>
  <add key="enableSimpleMembership" value="false" />
</appSettings>
marcind
I already had that set to false (was in the notes on converting to a mvc 3 beta app), doesn't effect it any.
Jason Haley
A: 

It is a known bug in Beta: Release Notes: Chapter Known Issues

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" />
Bcelik
Awesome that did it - thank you!
Jason Haley