Thursday, February 19, 2015

Encrypt and Decrypt the connection String in Web.Config file in asp.net

Introduction: In this article today I am going to explain how to Encrypt and Decrypt the connection String section in Web.Config file using  aspnet_regiis.exe command line utility

Description:


Step 1: Open Visual studio command prompt and run it as administration. Start menu>>All Programs>>Microsoft Visual studio 2010>> Visual studio Tools >> Visual studio command prompt (Right click and click on Run as administration).

Step 2: Encrypt the connection string in Web.Config file using aspnet_regiis.exe
   Syntax:
aspnet_regiis.exe -pef "connectionStrings" "Path of the Folder containing the Web.Config file"
Example:
aspnet_regiis.exe -pef "connectionStrings" "F:\articlemirror\blog"
This command only encrypts the ConnectionString section of Web.Config file. You got a successful message of encryption process. Now see the Web.config file of project. E.g. see the below attached screenshot of encrypted ConnectionString section of Web.config file.



Decrypt the Connection String:
Syntax:
aspnet_regiis.exe -pdf "connectionStrings" "Path of the Folder containing the Web.Config file"
Example:
aspnet_regiis.exe -pdf "connectionStrings" " F:\articlemirror\blog "

This command decrypts the ConnectionString section of Web.Config file.

 Is this article helpful for you?

If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

No comments:

Post a Comment