Request redirect to /Account/Login?ReturnUrl=%2f since MVC 3 install on server
I solved the problem by adding the following lines to the AppSettings section of my web.config file:
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>
I fixed it this way
- Go to IIS
- Select your Project
- Click on "Authentication"
- Click on "Anonymous Authentication" > Edit > select "Application pool identity" instead of "Specific User".
- Done.
Updated answer for MVC 4, heavily borrowed from this page and ASP.NET MVC issue with configuration of forms authentication section (and answered on both pages)
<appSettings>
...
<add key="PreserveLoginUrl" value="true" />
</appSettings>
...
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="43200" /> <!--43,200 in minutes - 30 days-->
</authentication>