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
In the previous article I have explained Create dynamic menu in asp.net, Getting the ID of last inserted record in asp.net using output parameter, How to reset or clear all web form controls in asp.net, Getting the ID of last inserted record using SQL Server database in asp.net, Explain cookies in asp.net OR Explain cookies with example in asp.net and Get Facebook logged in User details like Username, Email, Birthday, Profile picture, DOB and Gender .
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
aspnet_regiis.exe -pef "connectionStrings" "Path of the Folder containing the Web.Config file"
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:
aspnet_regiis.exe -pdf "connectionStrings" "Path of the Folder containing the Web.Config file"
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.
What do you think about this article?
If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.