user53885
user53885

Reputation: 3829

Want to use default configuration for SMTP from <system.net> configuration section

I'd like to put an encrypted password in the configuration section. I have the decryption function, but where do I put it so that when SMTPClient is instantiated using this configuration information that I can run the decryption function for the password?

Thanks for any tips!

Upvotes: 0

Views: 186

Answers (1)

Godeke
Godeke

Reputation: 16281

Derive your own class (MySmtpClient) from the SMTPClient class and after the base object is constructed read, decrypt and initialize the password from there. Your child class would vary from the base only in this detail.

I hope that you are using a standard encryption library such as in Encrypt and decrypt a string as using a custom function will probably provide minimal security (custom encryption is rarely solid).

Upvotes: 1

Related Questions