hi friends,
i need to learn about active directory and it features. can any body explain about "Active Directory".
My question is If I login to the "WindowsActiveDirectory" by using a
single "Username" and "Password", I never wants to type the "Username"
and "Password" again in any other modules in the Active Directory.
for ex:-
Once we login into our PC with single "Username" and "Password", we
never login again in our local machine like "local mail server login"
and "Sql server Login" etc.. how can i do this in Active Directory???
Need reply... It's urgent....
Loading
Bechir BejaouiPosted Jul 26, 2008, 7:55 PM
{
try
{
// Make use of the config file to store data
string sUserPath = ConfigurationSettings.AppSettings["ADUserPath"];
DirectoryEntry entry = new DirectoryEntry(sUserPath,
ConfigurationSettings.AppSettings["ADAdminLogin"],
ConfigurationSettings.AppSettings["ADAdminPassword"]);e
//Create user
DirectoryEntry user = entry.Children.Add("cn=" + UserName, "user");
user.Properties["sAMAccountName"].Add(login); //compte NT
user.Properties["sn"].Add(Nom);
user.Properties["givenName"].Add(Prenom);
user.Properties["description"].Add("Added member " + DateTime.Now.ToLongDateString());
//Additional properties
user.Properties["displayName"].Add(FirstName + " " + LastName + "[" + Firm + "]");
user.Properties["userPrincipalName"].Add(string.Format("{0}@{1}", login, ConfigurationSettings.AppSettings["ADDomain"]));
user.Properties["Mail"].Add(mail);
user.Properties["Company"].Add(Firm);
user.CommitChanges();
user.Invoke("SetPassword", new object[] {password} );
// Create an account ADS_UF_NORMAL_ACCOUNT
user.Properties["userAccountControl"].Value = 0x200;
user.CommitChanges();
//Make a reference to NT group
string LDAPDomain = System.Configuration.ConfigurationSettings.AppSettings["ADGroupePath"];
DirectoryEntry Group= new DirectoryEntry(LDAPDomain,
ConfigurationSettings.AppSettings["ADAdminLogin"],
ConfigurationSettings.AppSettings["ADAdminPassword"]);
//Add the user to the group
Group.Invoke("Add",new Object[]{user.Path.ToString()});
Group.CommitChanges();
Group.Close();
user.Close();
}
catch( Exception exception )
{
Console.WriteLine( exception.Message );
}