Active Directory与asp.net Web表单集成 [英] Active Directory Integration with asp.net web form

查看:79
本文介绍了Active Directory与asp.net Web表单集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在努力开发一个处理活动目录身份验证的asp.net Web表单。我们需要将表单身份验证和Windows身份验证的混合模式放在一起





是否有任何特殊配置可供IIS使用做?



谢谢

Hi All ,

I am working to develop an asp.net web forms that working on the active directory authentication . we need to make a mix mode of form authentication and windows authentication together


is there is any special configuration for IIS is this possible to do?

Thanks

推荐答案

混合身份验证相对容易。我建议搜索示例。我将简要解释一下我5年前所做的事情。



1.设置你的web.config以使用Forms Authentication。 https://msdn.microsoft.com/en-us/library/7t6b43z4 (v = vs.140).aspx [ ^ ]

2.将登录URL设置为一个页面,该页面将包含试图从HttpContext.Current.Request.ServerVariables获取用户ID的代码[LOGON_USER]如果打开Windows身份验证将会是这样。

3.然后在该单页上启用Windows身份验证。并且在Windows登录页面的代码中如果失败,则重定向到常规的LoginPage,这将要求输入用户名和密码。



所以,基本上会发生什么一个请求进来,ASP.Net查看web.config并将用户发送到WindowsLogin.aspx(或任何你的名字)。在该页面中,尝试从浏览器获取用户ID,如果已经过验证,请使用FormsAuthentication登录。如果它失效,重定向到常规的LoginPage,他们可以输入名称和密码。
Mixed authentication is relatively easy to do. I do suggest searching for examples. I'll briefly explain what I did about 5 years ago.

1. Set your web.config to use Forms Authentication. https://msdn.microsoft.com/en-us/library/7t6b43z4(v=vs.140).aspx[^]
2. Set the login url to a page that will have code which attempts to get the user id from HttpContext.Current.Request.ServerVariables["LOGON_USER"] which is how it will be if windows authentication is turned on.
3. Then enable windows authentication on that one single page. And in the code of that windows logon page if it fails, redirect to a regular LoginPage which will ask for the username and password.

So, essentially what happens is when a request comes in, ASP.Net looks at web.config and sends the user to WindowsLogin.aspx (or whatever you name it). In that page, attempt to get user id from browser and if validated, login them in with FormsAuthentication. If it failes, redirect to a regular LoginPage where they can type in name and password.


这篇关于Active Directory与asp.net Web表单集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆