Last time I used the sectioninformation class to encrypt and decrypt the Web. config file. Here I will introduce you to another method to encrypt and decrypt web. config.
The command line tool aspnet_regiis.exe is a DOS-like command tool called the command interpreter. When you use the command line tool to encrypt and decrypt database connection strings in the web. config file, you only need simple syntax commands.
Encryption Syntax:
Aspnet_regiis-VF "configuration node to be encrypted" "absolute path of the web. config file"
Decryption Syntax:
Aspnet_regiis-PDF "configuration node to be decrypted" "absolute path of the web. config file"
Implementation process:
Pre-encryption string
(1) Open the "Visual Studio 2005 command prompt" (start the method -->Program--> Microsoft Visual Studio 2005 --> Visual Studio Tools --> Visual Studio 2005 command prompt), enter the command prompt aspnet_regiis-Arg "etettings" "D: \ webconfig, press enter.
(2) Open "Visual Studio 2005 command prompt", enter the command prompt aspnet_regiis-PDF "etettings" "D: \ webconfig", and press Enter.
Complete!