-2

We store Administrator user and password (encrypted) in database. And want to use encrypted administrator password when using DirectoryEntry C# like this.

DirectoryEntry loginDirectory = new DirectoryEntry("ldap_path", "administrator", "Password");

how can I do it, i don't want to write admin password in code. Thanks

Marc
  • 19,394
  • 6
  • 47
  • 51
Durul Çamlı
  • 125
  • 1
  • 1
  • 7

1 Answers1

0

What you would do is use some form of two way encryption. You can read more about that here: Encrypt and decrypt a string

Then you would have the encrypted string in your database and then decrypt it when you're going to use it like this:

DirectoryEntry loginDirectory = new DirectoryEntry("ldap_path", "administrator", decrypt(database["Password"]));
Avitus
  • 15,640
  • 6
  • 43
  • 53