Encrypt connectionString in web.config

Hi!

I want to encrypt the connectionString settings in web.config.

I read that I'm able to use:

aspnet_regiis.exe -pdf “connectionStrings” C:\Projects\DemoApplication

Open in new window


But I have some questions:

My website is in my file system now, but I'll publish it later. It's ok to encrypt this way (above)?

My website works with typed DataSet to access SQL Server. Encrypting the connectionString will change any thing?

When I need to use the connectionString, may I use just:

string conn = ConfigurationManager.ConnectionStrings["SQL"].ConnectionString;

Open in new window


to get the connectionString? (The ASP.net will decrypt it automatically, right?)

Thanks in advance!
calypsoworldAsked:
Who is Participating?
 
Carl TawnSystems and Integration DeveloperCommented:
Yes. No. Yes. :)
0
 
DaveKeyesCommented:
Also, the correct parameter to encrypt is -pef, the -pdf will decrypt previously encrypted connection strings, allowing you to edit them.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
burakiewiczCommented:
Im not it will work if you encrypt on one machine and publish it out to a different machine
0
 
calypsoworldAuthor Commented:
> burakiewicz
I'm developing in my computer to publish to an IIS located on another computer.

If I can't decrypt in these conditions, how can I do that?

Thanks!

0
 
burakiewiczCommented:
you can decrypt the config push it to the computer that has iis and then encrypt/decrypt it on that machine
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.