将 Windows 身份验证与表单身份验证混合使用
考虑一个用于 Intranet 的站点,该站点也应该可以从 Internet 访问。在 Intranet 上,您希望使用 Windows 身份验证,而在 Internet 上,您希望用户使用表单身份验证来访问站点。
是否可以设置这两者的混合模式?我只想验证用户是否使用其中任何一个站点登录,而不使用两个站点。
Consider a site used for an intranet which should also be accessible from the internet. On the intranet you want to use Windows Authentication and on the internet you want the users to access the site using forms authentication.
Is it possible to set up a mixed-mode with these two? I just want to validate that the user is logged in with either of them without using two sites.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能想看看类似的问题:针对 AD 的混合模式身份验证,如果会员提供商失败,则回退到数据库
答案我提出了一个使用外观的解决方案。我利用这种方法在多个域、aspnet sql 提供程序和遗留身份验证数据库上集成 AD,取得了可观的成功。
You may want to look at a similar question: mixed mode authentication against AD and fallback to the database if it fail with Membership providers
In the answer I posit a solution using a facade. I have leveraged this approach to integrate AD on multiple domains, aspnet sql provider and a legacy authentication database with measurable success.
我知道没有内置的方法可以做到这一点。但您可以使用一个简单的解决方法:
选择表单身份验证作为主要身份验证并将 Windows 身份验证映射到它。您可以在应用程序 AuthenticateRequest 中使用 global.asax 或特殊的 http 处理程序或模块来执行此操作。在此请求中识别您的 Intranet 用户,并以编程方式使用 FormsAuthentication.SetAuthCookie 设置表单身份验证 cookie。
我实际上将其用于混合模式表单和 IP 号码身份验证,但我认为它也适用于表单和 Windows 身份验证。
顺便说一句:也许混合模式表单和 IP 号码身份验证是您问题的第二种解决方案。如果您的服务器是 DMZ 的一部分,您可以通过 IP 号子网检测您的 Intranet 用户。
I know of no build-in way of doing this. But you can use a simple workaround:
Choose forms authentication as your primary authentication and map windows authentication to it. You can do so in the applications AuthenticateRequest using global.asax or a special http handler or module. Identify your intranet user in this request and set the forms authentication cookie using FormsAuthentication.SetAuthCookie programmatically.
I actually use this for a mixed mode forms and IP-Number authentication, but I think it would work for forms and windows auth too.
By the way: Maybe mixed mode forms and IP-Number authentication is a second solution for your problem. If your server is part of a DMZ you can detect your Intranet user by the IP number subnet.
嘿,我看过这个页面谈论 IIS7 的 2 级身份验证: IIS 7.0 带有 Forms 身份验证和 Windows 身份验证的两级身份验证,以及与您具有相同要求的另一个:IIS 混合模式ASP.NET 应用程序的身份验证 -http://beaucrawford .net/post/IIS-ldquo3bmixed-modrdquo3b-authentication-for-ASPNET-Application.aspx,但我没有尝试任何,也许它对你有用?我想您只需要根据您的需要进行调整即可。
Hei, I had seen this page talking about 2 level authentication with IIS7: IIS 7.0 Two-Level Authentication with Forms Authentication and Windows Authentication, and this other that has the same requirements as you: IIS mixed mode authentication for ASP.NET Applications -http://beaucrawford.net/post/IIS-ldquo3bmixed-moderdquo3b-authentication-for-ASPNET-Application.aspx, but I didn't try any, maybe it works for you? I guess you just have to adapt it for your needs.