So I am having some issues with code written by another developer that
interfaces with Active Directory. We had a catastrophic failure on the
server and had to recreate the AD. No the following code does not work:
DirectoryEntry ou = new
DirectoryEntry("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username",
"password");
// Use the Add method to add a user in an organizational unit.
DirectoryEntry usr = ou.Children.Add("CN=" + fullName,"user");
// Set the samAccountName, then commit changes to the directory.
usr.Properties["samAccountName"].Value = txtLogin.Text;
usr.Properties["givenName"].Value = txtFirstName.Text;
usr.Properties["sn"].Value = txtLastName.Text;
usr.Properties["displayName"].Value = fullName;
usr.Properties["name"].Value = fullName;
usr.Properties["mail"].Value = txtEmail.Text;
usr.Properties["o"].Value = txtCompany.Text;
if(txtStreet.Text!=null && txtStreet.Text.Length > 0)
usr.Properties["streetAddress"].Value = txtStreet.Text;
if(txtCity.Text!=null && txtZip.Text.Length > 0)
usr.Properties["l"].Value = txtCity.Text;
usr.Properties["st"].Value = ddlState.SelectedItem.Value;
if(txtZip.Text!=null && txtZip.Text.Length > 0)
usr.Properties["postalCode"].Value = txtZip.Text;
if(txtPhone.Text!=null && txtPhone.Text.Length > 0)
usr.Properties["telephoneNumber"].Value = txtPhone.Text;
if (ddlRole.SelectedItem.Text.Equals("Guest"))
{
// Set the expiration
//usr.Properties["accountExpires"][0] =
expiresCal.SelectedDate.ToFileTime();
System.Int64 expireTicks = expiresCal.SelectedDate.ToFileTime();
LargeInteger l = new LargeIntegerClass();
l.HighPart = (int) (expireTicks >> 32);
l.LowPart = (int) (expireTicks & 0xFFFFFFFF);
usr.Properties["accountExpires"].Value = l;
}
usr.CommitChanges();
usr.Invoke("SetPassword", new object[]{txtPasswd.Text});
usr.CommitChanges();
usr.Properties["userAccountControl"].Value = 0x10200; // Note: this
value represents don't expire passwd
usr.CommitChanges();
// Add the user to the WISDMUsers Group
DirectoryEntry wisdmUsers = new
DirectoryEntry("LDAP://cn=WISDMUsers,cn=Users,dc=WISDM,dc=wisdm,dc=org",
"username", "password");
wisdmUsers.Invoke("Add", new object[] {usr.Path.ToString()});
}
catch (Exception ex)
{
errorMsg.Text = "Error adding user to Directory: " + ex.Message +
ex.StackTrace;
return;
}
It returns the following error:
Error adding user to Directory: There is no such object on the server at
System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) at
System.DirectoryServices.DirectoryEntry.Bind() at
System.DirectoryServices.DirectoryEntry.get_IsCont ainer() at
System.DirectoryServices.DirectoryEntries.CheckIsC ontainer() at
System.DirectoryServices.DirectoryEntries.Add(Stri ng name, String
schemaClassName) at TXDOT_Admin.CreateUser.saveEvent(Object sender, EventArgs
e)
I had to change the connection string to even get this far from
("LDAP://ou=WISDM,dc=WISDM,dc=dalwisdm,dc=org", "username", "password")
to
("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password")
Any ideas as to obvious things to look for? 4 2068
Did ur DC changed from Org to Com??
Something changed in this
ou=WISDM,dc=WISDM,dc=wisdm,dc=org
Check if the WISDM is still there
and dc is still org.
-- http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
---_,>/'_------
(_) \(_)
---------------
"Marc" wrote: So I am having some issues with code written by another developer that interfaces with Active Directory. We had a catastrophic failure on the server and had to recreate the AD. No the following code does not work:
DirectoryEntry ou = new DirectoryEntry("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password");
// Use the Add method to add a user in an organizational unit. DirectoryEntry usr = ou.Children.Add("CN=" + fullName,"user");
// Set the samAccountName, then commit changes to the directory. usr.Properties["samAccountName"].Value = txtLogin.Text; usr.Properties["givenName"].Value = txtFirstName.Text; usr.Properties["sn"].Value = txtLastName.Text; usr.Properties["displayName"].Value = fullName; usr.Properties["name"].Value = fullName; usr.Properties["mail"].Value = txtEmail.Text; usr.Properties["o"].Value = txtCompany.Text; if(txtStreet.Text!=null && txtStreet.Text.Length > 0) usr.Properties["streetAddress"].Value = txtStreet.Text; if(txtCity.Text!=null && txtZip.Text.Length > 0) usr.Properties["l"].Value = txtCity.Text; usr.Properties["st"].Value = ddlState.SelectedItem.Value; if(txtZip.Text!=null && txtZip.Text.Length > 0) usr.Properties["postalCode"].Value = txtZip.Text; if(txtPhone.Text!=null && txtPhone.Text.Length > 0) usr.Properties["telephoneNumber"].Value = txtPhone.Text; if (ddlRole.SelectedItem.Text.Equals("Guest")) { // Set the expiration //usr.Properties["accountExpires"][0] = expiresCal.SelectedDate.ToFileTime(); System.Int64 expireTicks = expiresCal.SelectedDate.ToFileTime();
LargeInteger l = new LargeIntegerClass(); l.HighPart = (int) (expireTicks >> 32); l.LowPart = (int) (expireTicks & 0xFFFFFFFF);
usr.Properties["accountExpires"].Value = l;
}
usr.CommitChanges();
usr.Invoke("SetPassword", new object[]{txtPasswd.Text}); usr.CommitChanges();
usr.Properties["userAccountControl"].Value = 0x10200; // Note: this value represents don't expire passwd usr.CommitChanges();
// Add the user to the WISDMUsers Group DirectoryEntry wisdmUsers = new DirectoryEntry("LDAP://cn=WISDMUsers,cn=Users,dc=WISDM,dc=wisdm,dc=org", "username", "password");
wisdmUsers.Invoke("Add", new object[] {usr.Path.ToString()}); } catch (Exception ex) { errorMsg.Text = "Error adding user to Directory: " + ex.Message + ex.StackTrace; return; }
It returns the following error:
Error adding user to Directory: There is no such object on the server at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_IsCont ainer() at System.DirectoryServices.DirectoryEntries.CheckIsC ontainer() at System.DirectoryServices.DirectoryEntries.Add(Stri ng name, String schemaClassName) at TXDOT_Admin.CreateUser.saveEvent(Object sender, EventArgs e)
I had to change the connection string to even get this far from ("LDAP://ou=WISDM,dc=WISDM,dc=dalwisdm,dc=org", "username", "password") to ("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password")
Any ideas as to obvious things to look for?
Also check for Username/Password..
-- http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
---_,>/'_------
(_) \(_)
---------------
"Marc" wrote: So I am having some issues with code written by another developer that interfaces with Active Directory. We had a catastrophic failure on the server and had to recreate the AD. No the following code does not work:
DirectoryEntry ou = new DirectoryEntry("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password");
// Use the Add method to add a user in an organizational unit. DirectoryEntry usr = ou.Children.Add("CN=" + fullName,"user");
// Set the samAccountName, then commit changes to the directory. usr.Properties["samAccountName"].Value = txtLogin.Text; usr.Properties["givenName"].Value = txtFirstName.Text; usr.Properties["sn"].Value = txtLastName.Text; usr.Properties["displayName"].Value = fullName; usr.Properties["name"].Value = fullName; usr.Properties["mail"].Value = txtEmail.Text; usr.Properties["o"].Value = txtCompany.Text; if(txtStreet.Text!=null && txtStreet.Text.Length > 0) usr.Properties["streetAddress"].Value = txtStreet.Text; if(txtCity.Text!=null && txtZip.Text.Length > 0) usr.Properties["l"].Value = txtCity.Text; usr.Properties["st"].Value = ddlState.SelectedItem.Value; if(txtZip.Text!=null && txtZip.Text.Length > 0) usr.Properties["postalCode"].Value = txtZip.Text; if(txtPhone.Text!=null && txtPhone.Text.Length > 0) usr.Properties["telephoneNumber"].Value = txtPhone.Text; if (ddlRole.SelectedItem.Text.Equals("Guest")) { // Set the expiration //usr.Properties["accountExpires"][0] = expiresCal.SelectedDate.ToFileTime(); System.Int64 expireTicks = expiresCal.SelectedDate.ToFileTime();
LargeInteger l = new LargeIntegerClass(); l.HighPart = (int) (expireTicks >> 32); l.LowPart = (int) (expireTicks & 0xFFFFFFFF);
usr.Properties["accountExpires"].Value = l;
}
usr.CommitChanges();
usr.Invoke("SetPassword", new object[]{txtPasswd.Text}); usr.CommitChanges();
usr.Properties["userAccountControl"].Value = 0x10200; // Note: this value represents don't expire passwd usr.CommitChanges();
// Add the user to the WISDMUsers Group DirectoryEntry wisdmUsers = new DirectoryEntry("LDAP://cn=WISDMUsers,cn=Users,dc=WISDM,dc=wisdm,dc=org", "username", "password");
wisdmUsers.Invoke("Add", new object[] {usr.Path.ToString()}); } catch (Exception ex) { errorMsg.Text = "Error adding user to Directory: " + ex.Message + ex.StackTrace; return; }
It returns the following error:
Error adding user to Directory: There is no such object on the server at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_IsCont ainer() at System.DirectoryServices.DirectoryEntries.CheckIsC ontainer() at System.DirectoryServices.DirectoryEntries.Add(Stri ng name, String schemaClassName) at TXDOT_Admin.CreateUser.saveEvent(Object sender, EventArgs e)
I had to change the connection string to even get this far from ("LDAP://ou=WISDM,dc=WISDM,dc=dalwisdm,dc=org", "username", "password") to ("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password")
Any ideas as to obvious things to look for?
Check for all vinay adviced and if problem persist
post it
Patrick
"Marc" <Ma**@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com... So I am having some issues with code written by another developer that interfaces with Active Directory. We had a catastrophic failure on the server and had to recreate the AD. No the following code does not work:
DirectoryEntry ou = new DirectoryEntry("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password");
// Use the Add method to add a user in an organizational unit. DirectoryEntry usr = ou.Children.Add("CN=" + fullName,"user");
// Set the samAccountName, then commit changes to the directory. usr.Properties["samAccountName"].Value = txtLogin.Text; usr.Properties["givenName"].Value = txtFirstName.Text; usr.Properties["sn"].Value = txtLastName.Text; usr.Properties["displayName"].Value = fullName; usr.Properties["name"].Value = fullName; usr.Properties["mail"].Value = txtEmail.Text; usr.Properties["o"].Value = txtCompany.Text; if(txtStreet.Text!=null && txtStreet.Text.Length > 0) usr.Properties["streetAddress"].Value = txtStreet.Text; if(txtCity.Text!=null && txtZip.Text.Length > 0) usr.Properties["l"].Value = txtCity.Text; usr.Properties["st"].Value = ddlState.SelectedItem.Value; if(txtZip.Text!=null && txtZip.Text.Length > 0) usr.Properties["postalCode"].Value = txtZip.Text; if(txtPhone.Text!=null && txtPhone.Text.Length > 0) usr.Properties["telephoneNumber"].Value = txtPhone.Text; if (ddlRole.SelectedItem.Text.Equals("Guest")) { // Set the expiration //usr.Properties["accountExpires"][0] = expiresCal.SelectedDate.ToFileTime(); System.Int64 expireTicks = expiresCal.SelectedDate.ToFileTime();
LargeInteger l = new LargeIntegerClass(); l.HighPart = (int) (expireTicks >> 32); l.LowPart = (int) (expireTicks & 0xFFFFFFFF);
usr.Properties["accountExpires"].Value = l;
}
usr.CommitChanges();
usr.Invoke("SetPassword", new object[]{txtPasswd.Text}); usr.CommitChanges();
usr.Properties["userAccountControl"].Value = 0x10200; // Note: this value represents don't expire passwd usr.CommitChanges();
// Add the user to the WISDMUsers Group DirectoryEntry wisdmUsers = new DirectoryEntry("LDAP://cn=WISDMUsers,cn=Users,dc=WISDM,dc=wisdm,dc=org", "username", "password");
wisdmUsers.Invoke("Add", new object[] {usr.Path.ToString()}); } catch (Exception ex) { errorMsg.Text = "Error adding user to Directory: " + ex.Message + ex.StackTrace; return; }
It returns the following error:
Error adding user to Directory: There is no such object on the server at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_IsCont ainer() at System.DirectoryServices.DirectoryEntries.CheckIsC ontainer() at System.DirectoryServices.DirectoryEntries.Add(Stri ng name, String schemaClassName) at TXDOT_Admin.CreateUser.saveEvent(Object sender,
EventArgs e)
I had to change the connection string to even get this far from ("LDAP://ou=WISDM,dc=WISDM,dc=dalwisdm,dc=org", "username", "password") to ("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password")
Any ideas as to obvious things to look for?
Thanks for the help with this one. I had to change the connection string as
the OU had changed underneath us.
"Patrick.O.Ige" wrote: Check for all vinay adviced and if problem persist post it Patrick
"Marc" <Ma**@discussions.microsoft.com> wrote in message news:1D**********************************@microsof t.com... So I am having some issues with code written by another developer that interfaces with Active Directory. We had a catastrophic failure on the server and had to recreate the AD. No the following code does not work:
DirectoryEntry ou = new DirectoryEntry("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password");
// Use the Add method to add a user in an organizational unit. DirectoryEntry usr = ou.Children.Add("CN=" + fullName,"user");
// Set the samAccountName, then commit changes to the directory. usr.Properties["samAccountName"].Value = txtLogin.Text; usr.Properties["givenName"].Value = txtFirstName.Text; usr.Properties["sn"].Value = txtLastName.Text; usr.Properties["displayName"].Value = fullName; usr.Properties["name"].Value = fullName; usr.Properties["mail"].Value = txtEmail.Text; usr.Properties["o"].Value = txtCompany.Text; if(txtStreet.Text!=null && txtStreet.Text.Length > 0) usr.Properties["streetAddress"].Value = txtStreet.Text; if(txtCity.Text!=null && txtZip.Text.Length > 0) usr.Properties["l"].Value = txtCity.Text; usr.Properties["st"].Value = ddlState.SelectedItem.Value; if(txtZip.Text!=null && txtZip.Text.Length > 0) usr.Properties["postalCode"].Value = txtZip.Text; if(txtPhone.Text!=null && txtPhone.Text.Length > 0) usr.Properties["telephoneNumber"].Value = txtPhone.Text; if (ddlRole.SelectedItem.Text.Equals("Guest")) { // Set the expiration //usr.Properties["accountExpires"][0] = expiresCal.SelectedDate.ToFileTime(); System.Int64 expireTicks = expiresCal.SelectedDate.ToFileTime();
LargeInteger l = new LargeIntegerClass(); l.HighPart = (int) (expireTicks >> 32); l.LowPart = (int) (expireTicks & 0xFFFFFFFF);
usr.Properties["accountExpires"].Value = l;
}
usr.CommitChanges();
usr.Invoke("SetPassword", new object[]{txtPasswd.Text}); usr.CommitChanges();
usr.Properties["userAccountControl"].Value = 0x10200; // Note: this value represents don't expire passwd usr.CommitChanges();
// Add the user to the WISDMUsers Group DirectoryEntry wisdmUsers = new DirectoryEntry("LDAP://cn=WISDMUsers,cn=Users,dc=WISDM,dc=wisdm,dc=org", "username", "password");
wisdmUsers.Invoke("Add", new object[] {usr.Path.ToString()}); } catch (Exception ex) { errorMsg.Text = "Error adding user to Directory: " + ex.Message + ex.StackTrace; return; }
It returns the following error:
Error adding user to Directory: There is no such object on the server at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_IsCont ainer() at System.DirectoryServices.DirectoryEntries.CheckIsC ontainer() at System.DirectoryServices.DirectoryEntries.Add(Stri ng name, String schemaClassName) at TXDOT_Admin.CreateUser.saveEvent(Object sender, EventArgs e)
I had to change the connection string to even get this far from ("LDAP://ou=WISDM,dc=WISDM,dc=dalwisdm,dc=org", "username", "password") to ("LDAP://ou=WISDM,dc=WISDM,dc=wisdm,dc=org", "username", "password")
Any ideas as to obvious things to look for? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Srinivas |
last post by:
Hi,
I've one system in which Active directory is installed.
That system is the domain controller as well as web
server - A test machine.
Trying all following to Authenticate Users using VB as...
|
by: microsoft |
last post by:
Hi People, when I try to modify an active directory user programatically, I
receive the following exception:
The server is unwilling to process the request
Reading the microsoft web site, I...
|
by: Bill |
last post by:
does anyone have any good resources to c# code to interface with iis,
exchange , and active directory.
i am tring to develope a management console
---
Outgoing mail is certified Virus Free....
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem...
|
by: Tim::.. |
last post by:
Hi...
I'm having a big problem with a datagrid that obtains data from 2 different
locations...
Active Directory and SQL Database
The data is inserted into a datatable and the sorted by a...
|
by: tangus via DotNetMonster.com |
last post by:
Hello all, I'm really struggling with getting some Active Directory code to
work in ASP.NET. Can you please provide assistance? I am executing the
following code:
Dim enTry As DirectoryEntry =...
|
by: pjdouillard |
last post by:
Hello all,
Here is the context of my problem:
We have an ASP.NET 1.1 application that has its own application pool
setup and that runs under the identity of a NT Domain service account
(this...
|
by: Keith Jakobs, MCP |
last post by:
Hi All....
I'm having a HECK of a time connecting to Active Directory using VB in
Visual Studio.NET 2003. Can anyone PLEASE help me?
All I am trying to do is list the current members of our...
|
by: happyse27 |
last post by:
Hi All,
I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |