Total Pageviews

Thursday, April 8, 2010

Encrypting and Decrypting ConnectinString

Web.Config







The easiest way to encrypt the section is to use the aspnet_regiis command-line tool.
This tool is located in the following folder:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\

Executing the following command encrypts the section of a Web.Config file
located in a folder with the path c:\Websites\MyWebsite:

aspnet_regiis -pef connectionStrings "c:\Websites\MyWebsite"

The -pef option (Protect Encrypt Filepath) encrypts a particular configuration section located at a particular path.

You can decrypt a section with the -pdf option like this:
aspnet_regiis -pdf connectionStrings "c:\Websites\MyWebsite"