public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ActiveDirectoryHelper obj = new ActiveDirectoryHelper();
string ldap = ConfigurationManager.AppSettings["LDAPPath"];
string ldapEu = ConfigurationManager.AppSettings["LDAPPathEurope"];
//getting user and domain
string u = System.Web.HttpContext.Current.User.Identity.Name;
int domainIndex = u.IndexOf(@"\");
string domain = u.Remove(domainIndex);
DirectoryEntry de;
if (domain.ToLower()=="microsoftcorp")
{
de = new DirectoryEntry(ldap);
}
else
{
de = new DirectoryEntry(ldapEu);
}
string s = u.Substring(domainIndex + 1);
myADUserDetail person = obj.GetUserByLoginName(s,de);
string co = person.Company;
string name = person.DisplayName;
string dep = person.Department;
string ss = person.ManagerName;
string ssdsss = person.ManagerName;
string sssss = person.EmployeeId;
lblUserName.Text = "WellCome: " + name + "<br/>" + co + " | " + dep ;
}
}