Encrypt and Decrypt the Section of Web.Config file using ASP.NET 2.0

For Encrypt or Decrypt the Section of Web.Config of the Application, Open ASP.NEt Command Promt and type the following command.

:"Encryption":

C:\Program Files\Microsoft Visual Studio 8\VC>
aspnet_regiis -pef "SectionName" "physical path of Web.Config file" -prov "DataProtectionConfigurationProvider"

:"Decryption":

C:\Program Files\Microsoft Visual Studio 8\VC>
aspnet_regiis -pdf "SectionName" "physical path of Web.Config file"


if the command giving error message that aspnet_regiis is not a command then use follwoing command:

:"Encryption":

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>
aspnet_regiis -pef "SectionName" "physical path of Web.Config file" -prov "DataProtectionConfigurationProvider"

:"Decryption":

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>
aspnet_regiis -pdf "SectionName" "physical path of Web.Config file"

 

If the Section Name is "ConnectionString" then write directly the Name, But if the Section is a Part of Any Root Section then Write the Name As Follow:

"Root Section Name/ Section Name"

For Example: "system.web/membership"