Thursday, 5 April 2018

Encrypt And Decrypt Connection String In Web.Config File Using Command Prompt


Encrypting Web.Config

  1. Open Command Prompt with Administrator privileges
  2. At the Command Prompt, enter: cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
    This command will narrate you to the framework version folder given.
  3. In case your web Config is located in "D:\Articles\EncryptWebConfig" directory path, then enter the following to encrypt the ConnectionStringASPNET_REGIIS -pef "connectionStrings" "D:\Articles\EncryptWebConfig"
    Use Aspnet_regiis.exe tool with the –pef option and specify the application path as shown above.
    Note: The parameter "connectionStrings" is case sensitive.
  4. Once you click the enter. You will get the output as follows.


Decrypt connection string
You can always decrypt the connection string if you want, to decrypt you just need follows the commands as follows at the command prompt.
cd C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319  
Once after you did you the above command you can execute the preceding one.
ASPNET_REGIIS -PDF "connectionStrings" "F:\Visual Studio\EncryptConnectionString\EncryptConnectionString" 
The text ‘connectionString’ is case sensitive as mentioned above 
If the command is correct, you can get an output as follows.



Now if you check your Web config again, you can see the connection string has got encrypted. Have a happy coding!

No comments:

Post a Comment

Sitecore Publishing Service 7.0 Installation Guide

  About the Publishing Service module The Publishing Service module is an optional replacement for the existing Sitecore publishing methods....