Link to home
Start Free TrialLog in
Avatar of IandINSW
IandINSW

asked on

How to hide the database connection string in the web.config

I would like to encrypt the database connection string so our developers do not know what the password is to connect to our production database.
We have 3 environments. Dev, test and Prod.  Dev and Test I have no issues with the Developer seeing the username and passwords unencrypted in the web.config file.  But when moving to the production environment I would like to hide this information from the developer.  Do I do the following?

run
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis.exe -pe "connectionStrings" -prov "DataProtectionConfigurationProvider" -app "/"
Encrypting configuration section...
Succeeded!

and then copy the resulting results to the web.config?  Or is their another solution?
Avatar of kaufmed
kaufmed
Flag of United States of America image

I haven't confirmed the parameters of your command, but yes, you would use aspnet_regiis for this purpose.
ASKER CERTIFIED SOLUTION
Avatar of BuggyCoder
BuggyCoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial