简体   繁体   中英

Mixed ASP.NET Site Forms Authentication Redirecting to the wrong place

In my web config

<authorization>
    <deny users="?" />
    <allow roles="Employee" />
</authorization>
<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

Then when I go to the page

    HTTP/1.1 302 Found
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Location: /Account/Login?ReturnUrl=%2f
    Server: Microsoft-IIS/7.5
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Tue, 23 Oct 2012 22:34:55 GMT
    Content-Length: 145

    <html><head><title>Object moved</title></head><body>
    <h2>Object moved to <a href="/Account/Login?ReturnUrl=%2f">here</a>.</h2>
    </body></html>

Why does LogOn not give me that but rather Login?

IIS 7.5

Site is

  • Classic Asp
  • ASP.Net

using the forms auth "hack" from

http://weblogs.asp.net/scottgu/archive/2007/03/04/tip-trick-integrating-asp-net-security-with-classic-asp-and-non-asp-net-urls.aspx

Add this key to your web.config:

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

Evidently there can be some redirection going on within the DLL's to a different "loginUrl", especially if the WebMatrix dll's are in the path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM