ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

How to handle encryption decription of connection string ?

(1/1)

gatewaytl:
Hi Friends,

I have created two functions that encrypt and decrypt the connection string in web.config. But whenever I want to use connection string. I have to always decrypt web.config and then again encrypt it back. Does there any other way which i can use.

I'm using section.SectionInformation.ProtectSection(" <encryption configuration provider> ") and section.SectionInformation.UnprotectSection()

CWuestefeld:
You can set things up so that the configuration section provider does the decryption for you. See this article.

Obviously, you (as the developer) need to do the initial work to encrypt the data and put it into the .config in the first place.

And, of course, if you've got a farm then each machine will by default have its own machine key for encrypt/decrypt, which would necessitate separately encrypted .config files for each machine, and that's no good. You'll need to set a different key, as described here.

Navigation

[0] Message Index

Go to full version