Tips, Tricks, and Fixes for when your computer doesn't do what it's told.

Tuesday, June 14, 2011

Web.config encryption

To encrypt the connection string section of a web config file:

1. Open a command prompt and cd to:
c:\Windows\Microsoft.NET\Framework\v2.0.*
2. Type the command:
aspnet_regiis -pe "connectionStrings" -app "/sitename" -prov DataProtectionConfigurationProvider

Note: The provider parameter is needed otherwise the app cannot read the encrypted section and will return the error "The RSA key container could not be opened"

More information: http://msdn.microsoft.com/en-us/library/ms998280.aspx

No comments: