0

在我的网络配置中

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

然后当我转到页面时

    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>

为什么 LogOn 不给我那个,而是给我登录?

IIS 7.5

网站是

  • 经典ASP
  • ASP.NET

使用表单 auth "hack"

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

4

1 回答 1

1

将此密钥添加到您的 web.config:

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

显然,在 DLL 中可能会发生一些重定向到不同的“loginUrl”,尤其是当 WebMatrix dll 在路径中时。

于 2012-10-24T00:55:29.727 回答