Encryption and decryption of the elements in web.config
Open the command promt like administrator and navigate to C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and type one of the following command:
1. Using IIS server:
Encryption:
aspnet_regiis.exe -pe "{element to encrypt}" -site "{site id}" -app "/{virtual direcrtory name if exist}"
Decryption:
aspnet_regiis.exe -pd "{element to decript}" -site "{site id}" -app "/{virtual direcrtory name if exist}
Examples:
aspnet_regiis.exe -pe "appSettings" -site "7" -app "/"
aspnet_regiis.exe -pd "appSettings" -site "7" -app "/"
2. Using file system:
Encryption:
aspnet_regiis.exe -pef "{element to encrypt}" {path to application}
Decryption:
aspnet_regiis.exe -pdf "{element to decript}" {path to application}
Examples:
aspnet_regiis.exe -pef "connectionStrings" "C:\Projects\Test\Test\WebApplication2"
aspnet_regiis.exe -pdf "connectionStrings" "C:\Projects\Test\Test\WebApplication2"