我已经在asp.net中制作了一个web应用程序。在我的项目中,通过在数据库中匹配用户名和密码来完成认证。但现在客户端要求我在应用程序中使用Active Directory认证。客户请求建议我使用AD中用户的电子邮件ID进行身份验证。活动目录认证
我想在广告中获取的记录,我可以获取用户的全名,但我无法得到的电子邮件ID,
我试过代码:
System.Security.Principal.WindowsIdentity wi = System.Security.Principal.WindowsIdentity.GetCurrent();
string[] a = Context.User.Identity.Name.Split('\\');
System.DirectoryServices.DirectoryEntry ADEntry = new System.DirectoryServices.DirectoryEntry("WinNT://" + a[0] + "/" + a[1]);
string Name = ADEntry.Properties["FullName"].Value.ToString();
进一步我使用DirectorySearcher,但它genterates错误,Coulnot搜索客户端服务器中的记录..