Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Change Password Error with ADAM when running code on production

  Asked By: Jeanne    Date: Aug 19    Category: Sharepoint    Views: 979

I have tested following code for change adam password successfully.
Now whenever I test this code on production server, it is giving me
error "Logon failure: unknown user name or bad password" in following
line
objUser.Invoke("SetOption", new object[] {
ADS_OPTION_PASSWORD_PORTNUMBER, intPort });

We have implemented SSL on ISA server, there is no SSL on
MOSS/sharepoint server.I tried various options, but does not found
any solution. Let me know how do I resolve this? Please review
following code
*---------- Code Start

try
{
const long ADS_OPTION_PASSWORD_PORTNUMBER = 6;
const long ADS_OPTION_PASSWORD_METHOD = 7;
const int ADS_PASSWORD_ENCODE_CLEAR = 1;
AuthenticationTypes AuthTypes;
int intPort;
DirectoryEntry objUser;
string strPath;
string strPort;
string strServer;
string strUser;

strServer = "spweb01";
strPort = "389";
strUser = "CN=" + strUserName.ToString().Trim()
+ ";OU=InterUsers,OU=IntADAM,O=ADAM,C=US";
strPath = String.Concat("LDAP://", strServer,
":", strPort, "/", strUser);
output.Text += "struser" + " - " + strUser.ToString()
+"<br>";
output.Text += "strpath" + " - " + strPath.ToString()
+ "<br>";
output.Text += "Bind to: {0}" + strPath + "<br>";
AuthTypes = AuthenticationTypes.Signing |
AuthenticationTypes.Sealing |
AuthenticationTypes.Secure; output.Text +=
AuthTypes.ToString() + "<br>";
output.Text += "New Password: "+
newpassword.Text.ToString();
try
{
objUser = new DirectoryEntry(
strPath, null, null, AuthTypes);
}
catch (Exception ex)
{
output.Text += "Error: Bind failed." + " - " +
ex.Message + " - " + strUser.ToString() + "<br>";
return;
}
output.Text += "Error: Bind Succesfull" + " - " +
strUser.ToString() + "<br>";
intPort = Int32.Parse(strPort);
output.Text+=intPort.ToString()+"<br>";
try
{
objUser.Invoke("SetOption", new object[] {
ADS_OPTION_PASSWORD_PORTNUMBER, intPort });
output.Text += "Option Set Start" + "<br>";
objUser.Invoke("SetOption", new object[]
{ADS_OPTION_PASSWORD_METHOD, ADS_PASSWORD_ENCODE_CLEAR});
output.Text += "Option Set End" + "<br>";
output.Text += "Set Password - Start - " +
newpassword.Text.ToString()+"<br>";
objUser.Invoke("SetPassword", new object[] {
newpassword.Text.ToString() });
objUser.CommitChanges();
output.Text += "Set Password - End" + "<br>";
}
catch (Exception ex1)
{
output.Text += "Password Failed " + ex1.Message
+ " - " + strUser.ToString();

return;
}
output.Text = "<BR> Password is changed";
return;
}
catch (Exception error)
{
output.Text += "A8 - User Password Change Error:\n" +
error.StackTrace.ToString() + "\n" + error.Message.ToString();
output.Text += "<BR>" + error.Message.ToString();
}

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Jerod Carrillo     Answered On: Aug 19

Are you able to resolve  the below issue? Even I am facing the same issue,
suddenly my ADAM stopped creating users and throwing an error  "object not found
on the server"

 




Tagged: