【问题标题】:Avoiding authentication required popup while using integrated windows authentication and accessing application from internet在使用集成的 Windows 身份验证和从 Internet 访问应用程序时避免需要身份验证的弹出窗口
【发布时间】:2013-05-06 05:52:35
【问题描述】:

我需要为同时在 Intranet 和 Internet 上使用的应用程序实施类似 Single Sign On 的功能。 现在,该应用程序使用自己的表来存储用户信息,并且比公司的 AD 中的用户更多。示例合同工/第 3 方供应商等,因此许多不属于域的 Active Directory 的用户都列在用户表中。

应用程序有点旧,目前它使用表单来验证用户。 但奇怪的是,web.config 文件中的身份验证模式有以下身份验证条目。 <authentication mode="None" />

我在 web.config 中将身份验证模式更改为 Windows,在 IIS 6 中选择了集成 Windows 身份验证并取消选中匿名访问。

现在我有以下两种情况。

#1 Intranet
用户使用存储在 AD 中的系统凭据登录系统 现在,如果用户点击 Web 应用程序的链接,他应该已经登录。 我已经通过在 login.aspx 的页面加载中使用 Page.User.Identity.name 来实现这部分,以检查用户是否存在于数据库中。

#2 Internet
如果我从外部网络检查它,浏览器会提示我输入凭据。
要求是不应提示用户输入凭据,而是应显示当前登录页面

我每次都用谷歌搜索并最终访问 stackoverflow。遗憾的是,这些解决方案对我来说并不奏效。

我偶然发现了 Scott Enabling Windows Authentication within an Intranet ASP.NET Web application 的这篇文章,如果您查看 cmets,Scott 指的是评论者 ripster 使用解决方案,以防应用程序从 Internet 和 Intranet 访问。虽然它对我没有效果,或者可能是我做得不好。

【问题讨论】:

    标签: asp.net authentication windows-authentication


    【解决方案1】:

    您似乎需要混合使用 Windows 和 Forms 身份验证:要求是不应提示用户输入凭据,而是应显示当前登录页面

    想分享这个。可能它可以帮助你,因为我看到人们非常喜欢下面提到的第二个解决方案。 (至少在他们阅读时。)

    如果您处于经典模式 - 您可以同时使用 Windows 和 Forms 身份验证。会弹出警报

    Challenge-based and login redirect-based authentication cannot be used 
    simultaneously
    

    但是,您可以忽略此警告。 CarlosAg 说:

    we decided to leave it there was because it is still behavior that many user 
    scenarios  would be consider incorrect, since most of the time forms 
    authentication  uses anonymous  authentication and not windows.
    

    阅读here.

    现在,当您想使用集成模式时,这个堆栈问题:iis7 Challenge-based and login redirect-based authentication cannot be used simultaneously 会导致这个著名的链接:http://mvolo.com/iis-70-twolevel-authentication-with-forms-authentication-and-windows-authentication/,它允许更改页面的身份验证方式。 使用 Windows 身份验证时管理此问题的另一种方法是使用代码管理用户名:

    string user = Request.ServerVariables["LOGON_USER"];
    

    请参考此链接:http://beensoft.blogspot.in/2008/06/mixing-forms-and-windows-authentication.html,它提供了一种混合表单和 Windows 身份验证的不同方式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      相关资源
      最近更新 更多