Saturday, April 9, 2016

Encryption and Decryption of Connection Strings in Web.config File via command line

Encryption and Decryption of Connection Strings in Web.config File

You can encrypt and decrypt the tags in web.config file using command line.

Go to command prompt:
Then go to the respective framework.

For encryption and decryption of "connectionStrings" tag

Encrypt:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pe "connectionStrings" -app "/appname"

Decrypt:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pd "connectionStrings" -app "/appname"

For encryption and decryption of "appSettings" tag

Encrypt:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pe "appSettings" -app "/appname"

Decrypt:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pd "appSettings" -app "/appname"