Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

DirectoryEntry Reset Password Error Reseting password Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Avatar of zekuser
zekuser asked on
ASP.NETActive Directory
11 Comments1 Solution2748 ViewsLast Modified:
I'm having a problem moving code to reset passwords to production.  The following code works in my development environment and when I run it locally in IIS.  However, when I move it to produciton I get the Error Reseting password Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) when trying to reset a users password.  My Localy IIS Account is just running under the ASPNET account.
string domainAndUsername = domain + @"\" + admusername;
 
            DirectoryEntry entry = new DirectoryEntry(@"LDAP://" + servername, domainAndUsername, admpassword);
       
                object obj = entry.NativeObject;
 
                DirectorySearcher search = new DirectorySearcher(entry);
 
                search.Filter = "(SAMAccountName=" + username + ")";
 
                search.PropertiesToLoad.Add("cn");
 
                SearchResult result = search.FindOne();
                DirectoryEntry objUser = result.GetDirectoryEntry();
                objUser.Invoke("SetPassword", newpwd);
                objUser.CommitChanges();
ASKER CERTIFIED SOLUTION
Avatar of CB_Thirumalai
CB_ThirumalaiFlag of India image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answers