如何取得AD的帐号 在一个AD域里面,ASP.NET,如何取得客户机域帐号?即IIS服务器是一个域成员,其他PC机都是加入域的方式. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.DirectoryServices;using System.Collections; public bool IsAuthenticated(string domain,string username,string pwd) { string domainAndUsername=domain+@"\"+username; DirectoryEntry entry=new DirectoryEntry(_path,domainAndUsername,pwd); try { Object obj=entry.NativeObject; DirectorySearcher search=new DirectorySearcher(entry); search.Filter="(SAMAccountName="+username + ")"; search.PropertiesToLoad.Add("cn"); SearchResult result=search.FindOne(); if(null==result) { return false; } _path=result.Path; _filterAttribute=(String)result.Properties["cn"][0]; } catch(Exception ex) { System.Console.Write(ex.Message); return false; } return true; } 求助关于GridView中添加Dropdownlist对数据库进行操作取值问题 Page.Header.Title = "标题";报错,怎么解决? asp.net 中跳转页面的时候 路径加@什么意思 gridview的分页问题 困擾我好久的難題,求助!!! 帮我看段程序 求助 [asp.net] 保存数据库连接串是放在在config.web中吗? 能不能实现从服务器主动发送到客户端? 求助图片与文字混排的新闻发布与新闻浏览实现思路!! 急~~~~~~~~~~~~~~~~~~简单问题 求C#完成百度搜索的UserControl--我菜希望各位高手指教[给分30]
using System.Collections; public bool IsAuthenticated(string domain,string username,string pwd)
{
string domainAndUsername=domain+@"\"+username;
DirectoryEntry entry=new DirectoryEntry(_path,domainAndUsername,pwd);
try
{
Object obj=entry.NativeObject;
DirectorySearcher search=new DirectorySearcher(entry);
search.Filter="(SAMAccountName="+username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result=search.FindOne();
if(null==result)
{
return false;
}
_path=result.Path;
_filterAttribute=(String)result.Properties["cn"][0];
}
catch(Exception ex)
{
System.Console.Write(ex.Message);
return false;
}
return true; }