One of the cool new features of ASP.NET 2.0 is the ability to encrypt any section of the Web.config. This is not directly supported by Visual Studio, however. You need to run aspnet_regiis.exe at a Visual Studio 2005 Command Prompt (look under Visual Studio Tools in your Visual Studio 2005 start menu group). 

 

To encrypt the connectionStrings section of an IIS virtual root based Web site named WebSite1, enter the following at the command prompt:
aspnet_regiis -pe "connectionStrings" -app "/ WebSite1"

 

To decrypt the same section, enter the following:
aspnet_regiis -pd "connectionStrings" -app "/ WebSite1"

 

 

You can also encrypt/decrypt sections of file-system based Web sites. For example, if the same WebSite1 site was not a virtual root and was located in the d:\WebSites folder, you would enter the following at the command prompt instead to encrypt the connectionStrings section:
aspnet_regiis -pef "connectionStrings" "d:\WebSites\WebSite1"

 

And to decrypt the same section of the same Web site:
aspnet_regiis -pdf "connectionStrings" "d:\WebSites\WebSite1"

Paul

 

Sponsor