Encrypt or Decrypt Connection string


This code snippet shows how to encrypt or decrypt connection string section contained in the web.config file of your website. Use the "aspnet_regiis.exe" utility to encrypt or decrypt the connection string section of the web.config file.

This code snippet shows how to encrypt or decrypt connection string section contained in the web.config file of your website. Use the "aspnet_regiis.exe" utility to encrypt or decrypt the connection string section of the web.config file.

Use the aspnet_regiis.exe utility to encrypt the connection string section of the web.config file.

Use the below command to Encrypt the connection string in the web.config file.

Here you have to specify the full path to your website folder which is the complete physical path of your website. Make sure it is correct before running this utility:


aspnet_regiis -pef "connectionStrings" "C:\...\EncryptionWebSite123"

If any changes are made to the connectionStrings section. The changes are reflected automatically that is, you don't have to run the aspnet_regiis utility again.

You can decrypt the connectionStrings section by using the following command:

aspnet_regiis -pdf "connectionStrings" "C:\...\EncryptionWebSite123"

here,
"-pef" switch is used for encryption
"-pdf" switch is used for decryption.


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: