Request redirect to /Account/Login?ReturnUrl=/ since MVC 3 install on server

前端 未结 14 1998
攒了一身酷
攒了一身酷 2020-12-04 08:51

We have an internal ASP.NET Webforms application running on a Windows 2008/IIS7 server which has been running fine until we installed MVC3.

Now any requests redirect

相关标签:
14条回答
  • 2020-12-04 09:42

    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>
    
    0 讨论(0)
  • 2020-12-04 09:43

    We added some WCF SOAP related things to an existing IIS site and it caused this problem, with the site refusing to honour the web.config authentication redirect.

    We tried the various fixes listed without success, and invented a work around of mapping the new weird URL back to the one we've been using for years:

    <urlMappings enabled="true">
    <add mappedUrl="~/loginout.aspx" url="~/Account/Login"/>
    </urlMappings>
    

    That worked but it's ugly. Eventually we traced it down to a web.config entry added by Visual Studio some time earlier:

    <add key="webpages:Enabled" value="true" />
    

    As we'd been unable to work out precisely what that does, we took it out, which solved the problem for us immediately.

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