topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 8:40 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: How to handle encryption decription of connection string ?  (Read 4195 times)

gatewaytl

  • Participant
  • Joined in 2008
  • *
  • Posts: 1
    • View Profile
    • Donate to Member
How to handle encryption decription of connection string ?
« on: October 16, 2008, 03:59 AM »
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

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,009
    • View Profile
    • Donate to Member
Re: How to handle encryption decription of connection string ?
« Reply #1 on: October 16, 2008, 08:54 AM »
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.