asp.net - Getting user password from Active Directory -


I am using Active Directory in my ASP.NET project and when a user registers in the site, an account Made in ed. Forgot your password. It is possible to get user password from AD I can get names or emails, but I do not know if I can get a password.

It is impossible to suggest that you do not apply the 'forgot password' functionality, rather 'Password Reset' lets you generate a new password, reset the password to Active Directory and send the user a new password.

Edit : Based on the information in your comments. First of all, this is a very bad idea in the way you use your administrator account, along with the account name and password as part of your code. You are running an asp.net site, so you must configure the application pool to run with this account.

Second, you should create a DirectoryEntry with the correct path, reset password I'm not sure what your oEntry is:

< Pre> var userEntry = new DirectoryEntry ("LDAP: // CN = SomeUser, OU = user, DC = yourdomain, DC = com"); Use (user entry) {userEntry.Invoke ("SetPassword", new object [] {"newpassword"}); UserEntry.CommitChanges (); }

Comments