DirectoryServices问题 100分。救命。。。。。

zhangzhiwei 2005-12-22 03:17:19
#region LoginByAccount(string userName, string passWord)判断用户帐号与密码是否足够以满足身份验证进而登录
/// <summary>
/// 登陆、判断用户帐号与密码是否足够以满足身份验证进而登录
/// </summary>
/// <param name="sAMAccountName">用户帐号</param>
/// <param name="password">密码</param>
/// <returns>如能可正常登录,则返回 true;否则返回 false</returns>
public LoginResult LoginByAccount(string userName, string passWord)
{
try
{
DirectoryEntry entry = new DirectoryEntry(ADPath, userName, passWord, AuthenticationTypes.Secure);
DirectorySearcher mySearcher = new DirectorySearcher(entry);
ADHelperClass.mySearcher=mySearcher;
mySearcher.Filter = "(sAMAccountname="+userName+")";
SearchResult resEnt= mySearcher.FindOne();
int userAccountControl = Convert.ToInt32(resEnt.Properties["userAccountControl"][0]);
entry.Close();
if (!IsAccountActive(userAccountControl))
{
return LoginResult.LOGIN_USER_ACCOUNT_INACTIVE;// 必须在判断用户密码正确前,对帐号激活属性进行判断;否则将出现异常。
}
else
{
this.Department=resEnt.Properties["Department"][0].ToString();
this.Company=resEnt.Properties["Company"][0].ToString();
this.Name=resEnt.Properties["cn"][0].ToString();
this.Title=resEnt.Properties["Title"][0].ToString();
this.Mail=resEnt.Properties["Mail"][0].ToString();
this.ADUser=resEnt.Properties["samaccountname"][0].ToString();
this.ManagerADPath=resEnt.Properties["manager"][0].ToString();
return LoginResult.LOGIN_USER_OK;
}
#region 循环得到所有的属性值
/*foreach (string propertyName in resEnt.Properties.PropertyNames )
{
string oneNode = propertyName + ": " +
resEnt.Properties[propertyName][0].ToString()+"\n";
//this.TextBox1.Text=this.TextBox1.Text+oneNode;
}*/
#endregion
}
catch
{
return LoginResult.LOGIN_USER_DOESNT_EXIST_OR_PASSWORD_INCORRECT;
}
}
#endregion



这些代码在windows2003上运行一切都正常的,但是在windows2000的系统上就出现问题了,得不到活动目录服务的信息,因为,我们的WEB服务器是windows2000的,这个是为什么啊?是不是2000上缺少什么东西?什么服务?或者要装什么服务啊??
求救 。。。。。

...全文
146 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangzhiwei 2005-12-26
  • 打赏
  • 举报
回复
谢谢 liuredstar(Flying) 哇,你是大好人。
liuredstar 2005-12-26
  • 打赏
  • 举报
回复
帮你顶。
liuredstar 2005-12-26
  • 打赏
  • 举报
回复
帮你顶。
zhangzhiwei 2005-12-23
  • 打赏
  • 举报
回复
老大们帮忙哇???
zhangzhiwei 2005-12-23
  • 打赏
  • 举报
回复
不要沉。大家帮忙哇
z0579 2005-12-22
  • 打赏
  • 举报
回复
不要沉。不要沉。。。。。。。。。
z0579 2005-12-22
  • 打赏
  • 举报
回复
jacky125() 你是不是在2000上打2003的补丁和插件哇???具体是哪些啊!
刚刚得到老大回复,WEB服务器不会把2000升级到2003的。
哎。。我怎么就这么命哭啊!~~~~~~
我WEB服务器的访问权限也没的。
z0579 2005-12-22
  • 打赏
  • 举报
回复
我们的WEB服务器不可能让我吓整活的啊。哎。。。。。。。。顶啊。
jacky125 2005-12-22
  • 打赏
  • 举报
回复
这个问题我也遇到过,最后不知道怎么就搞好了.
我下载安装了很多2003的一些补丁和差件.
把两个系统的IIS调整的一模一样.
z0579 2005-12-22
  • 打赏
  • 举报
回复
顶啊。。。
z0579 2005-12-22
  • 打赏
  • 举报
回复
我越来越佩服MS了。。
gqchen1981 2005-12-22
  • 打赏
  • 举报
回复
我原来也有个项目,
在2000和2000server上没问题
但是在xp和2003上就不行。
我研究了好多天,
我们最后解决的办法就是:
重装系统......
你的问题我不太清楚,看有没有人知道。

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧