Thursday, September 27, 2007

Encrypting & Decrypting Connection string at webconfig

Encrypting Connection string

 

Enter the userid & password in the connection string section of the Web.Config file. The connection string property can be encrypted using the following command:

 

Example:

aspnet_regiis.exe –pef “connectionStrings” “D:\Services” –prov “DataProtectionConfigurationProvider”

 

The aspnet_regiis.exe command can be found in the %WINDOWDIR%\Micorsoft.Net\Framework\version directory. The command can also be run directly if the dos prompt is opened from the Visual Studio SDK.

 

Decrypting Connection string

 

To change the userid or password, the connection string can be decrypted using the following command:

 

Example:

aspnet_regiis.exe –pdf “connectionStrings” “D:\Services”