ASP.NET MVC3 and Windows Auth on IIS keeps redirecting to /Account/Login

后端 未结 13 2783
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 03:27

I\'m running MVC3 and a windows auth web application. When I deploy to IIS6 it runs great until I hit a page that requires authentication. It then is auto-redirecting to /

相关标签:
13条回答
  • 2020-11-28 03:47

    Check whether you have WebMatrix.Data.dll and/or WebMatrix.WebData.dll deployed in the bin directory of your application. If they are there (and you know you don't use them) then try removing them and accessing a page that requires authentication.

    0 讨论(0)
  • 2020-11-28 03:47

    Another way to override "login.aspx url redirection problem with MVC + IIS 7"... by adding this to your appSettings (web.config) :

    <authentication mode="Forms">
    <!--<forms loginUrl="~/Account/Login" timeout="2880" />-->
    <forms loginUrl="~/Home" timeout="2880" />
    </authentication>
    

    ...This resolved the problem for me

    0 讨论(0)
  • 2020-11-28 03:47

    Make sure that all the authentication settings in IIS are correct.

    For me the application that redirected to /Account/Login was running within a site that Anonymous authentication enabled. After disabling this in the site and enabling it for the application (together with Windows authentication) it was ok.

    0 讨论(0)
  • 2020-11-28 03:48

    I was using nopCommerce 2.65 and had this issue.

    I did not have any of WebMatrix.Data.dll nor WebMatrix.WebData.dll deployed in the bin folder, but adding

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

    in the web.config solved it.

    0 讨论(0)
  • 2020-11-28 03:52

    I had the same issue in my MVC4 project, only my project has Anonymous Authentication disabled outright, so Windows Authentication is always required.

    I have no WebMatrix.* in my bin folder, and adding the autoFormsAuthentication and enableSimpleMembership keys to appSettings didn't do it for me.

    Instead, I had to comment out the following:

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

    And replace it with this:

    <authentication mode="Windows" />
    

    That did the trick.

    0 讨论(0)
  • 2020-11-28 03:53

    I know this is a super old post. But I just ran across this after going through a tutorial on upgrading from MVC 4 to MVC 5. So I'm throwing it on just in case anyone else makes the mistake I did. My issue ended up being that I accidently added 'Microsoft.AspNet.WebPages.WebData' to my project while upgrading my references.

    Running "Uninstall-Package Microsoft.AspNet.WebPages.WebData" restored my authentication to it's previous glory.

    0 讨论(0)
提交回复
热议问题