2

I have this section in the Web.config for my MVC3 application:

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="20" slidingExpiration="true"/>
</authentication>

Until recently every time the code hit an [Authorize] attribute the LogOn.cshtml page was shown. All of a sudden the redirection takes place to Account/Login (not the 'i' instead of the 'O'!!!) and I get a resource not found exception. I did a Find on the Web.config and could not find the word 'login' anywhere! What on Earh can have gone wrong?

2
  • Have you checked the "extra" Web.configs in the View directory sub-tree? Does this happen on both debug and release builds? (different config templates).... Maybe do a "grep" for Login within your solution. Commented Aug 28, 2011 at 11:22
  • There is no reference to Account\Login to be found anywhere... Commented Aug 28, 2011 at 11:53

1 Answer 1

4

This is a known issue with ASP.NET MVC 3 as stated in the release notes. To solve it simply add the following to the <appSettings> node of your web.config:

<appSettings>
    <add key="loginUrl" value="~/Account/LogOn" />
<appSettings>

or try with the following key as suggested by the release notes:

<add key="autoFormsAuthentication" value="false" />
Sign up to request clarification or add additional context in comments.

2 Comments

I have to correct that, after a time the problem recurred! I simply renamed the Action to be rid of this annoyance.
As suggested in the release notes you must use <add key="enableSimpleMembership" value="false" /> in conjunction with Darin's second suggestion.Known issues are at times annoying

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.