如何从Intranet应用程序获取电子邮件地址 [英] how to get email address from intranet application

查看:70
本文介绍了如何从Intranet应用程序获取电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我尝试通过使用System.DirectoryServices.AccountManagement.UserPrincipal.Current.EmailAddress从AD获取电子邮件地址.
它在我的本地计算机(VS2008)中工作,但是在Web服务器上尝试输入"System.DirectoryServices.AccountManagement.GroupPrincipal"时出现错误"system.DirectoryServices.AccountManagement.GroupPrincipal".
我将IIS 6.0与虚拟目录一起使用,并且已将其设置为虚拟目录上的窗口身份验证.
同样在我的web.config中,我将< authentication mode ="Windows">设置为并将站点添加到我的本地Intranet站点.

非常感谢您的帮助.

Hi, I try to get email address from AD by using System.DirectoryServices.AccountManagement.UserPrincipal.Current.EmailAddress.
It works in my local (VS2008) but I got error ''system.DirectoryServices.AccountManagement.GroupPrincipal'' to type ''System.DirectoryServices.AccountManagement.UserPrincipal'' when I try it on my web server.
I am using IIS 6.0 with virtual directory and I have set it to window authentication on the virtual directory.
Also in my web.config, I set <authentication mode="Windows"> and added the site to my local intranet sites.

Any help is greatly appreciated.

推荐答案

在代码中指定用于连接到AD的用户凭据需要管理员权限.检查是否正确.
The user credentials specified to connect to the AD from in code needs admin permissions. Check this is true.


这篇关于如何从Intranet应用程序获取电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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