This is fairly easy if you know the special sauce for encrypting Asp.Net web.config. You can use the built in functionality of Asp.Net. Go to Start => All Programs => Microsoft Visual Studio 2005/2008 => Visual Studio Tools =>Microsoft Visual Studio 2005/2008 Command Prompt.

Type in the following command (for using IIS):

aspnet_regiis.exe -pe "connectionString" -app "/<my virtual directory>"

You should see ‘Encrypting configuration section…" followed by "Succeeded!"

That is the first half. You then need to execute a second command to prevent, "Failed to decrypt using provider ‘RsaProtectedConfigurationProvider’. Error message from the provider: The RSA key container could not be opened".

aspnet_regiis.exe -pa "NetFrameworkConfigurationKey" "ASPNET"

You should see "Adding ACL for access to the RSA Key container…" followed by "Suceeded!"

Here are the two web sites I used to find this:

How to Encrypt connection string in web.config

Encrypting configuration files using protected configuration