C# 获取当前域的路径值

做域认证的情况下,

要先获取域的path,

可以先用代码获取当前域的path。

string pathCur = "LDAP://RootDSE";

 DirectoryEntry ent = new DirectoryEntry(pathCur);
 String str = ent.Properties["defaultNamingContext"][0].ToString();

 string strPath = "LDAP://" + str;

 路径“LDAP://RootDSE”,表示当前域。 可获取当前域的完整路径值

 

posted @ 2016-12-23 15:09  coinci  阅读(926)  评论(0编辑  收藏  举报