C:\>aspnet_regiis -pe "appSettings" -location "web.config" -prov "RsaProtectedConfigurationProvider"
Your location is incorrect on this line. When you use the -pd switch -pd based on IIS application paths and web.config is considered the encryption point.
So, for example, if you have an application called “Website 1” and another “Website 2” in IIS, and you want the web.config in “Website 1” to be encrypted, you used would this line:
C:\>aspnet_regiis -pe "appSettings" -location "Website 1" -prov "RsaProtectedConfigurationProvider"
Personally, it was easier for me to use the -pef switch, because I can point directly to the physical directory of the web application.
Follow the MSDN instructions for Encrypting configuration information using a secure configuration . I have used it several times and still have no problem using encyrption.
Gavin miller
source share