To encrypt a section in the web configuration file, use the aspnet_regiis command-line tool.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe
The following command encrypts the connectionStrings section of a configuration file located in a folder named MyWebApp:
aspnet_regiis -pef connectionStrings c:\Websites\MyWebApp
To use the virtual path.
The following command encrypts the connectionStrings section of a configuration file located in a virtual directory named /MyApp:
-app option is used to specify the application's virtual path.
aspnet_regiis -pe connectionStrings -app /MyApp
|