← Tutti gli articoli

How to Encrypt & Decrypt connectionStrings in the Web.config

26 dicembre 2010  · Asp.Net · Article  ·  281 visite

How to Encrypt & Decrypt connectionStrings in the Web.config. You can use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) to encrypt or decrypt sections of a Web configuration file.

1) Run the Command Prompt with Administrative Privilege

2) cd %WinDir%\Microsoft.NET\Framework\

3) Choose your Framework:  cd v4.0.30319

4) To encripty the connectionStrings section in the web.config located
in C:\inetpub\wwwroot\Maragna.Net run the following command:

aspnet_regiis -pe "connectionStrings" -app "/adfin" -prov "RsaProtectedConfigurationProvider"

(or aspnet_regiis -pef "connectionStrings" "C:\inetpub\wwwroot\Maragna.Net\Web.config" -prov "RsaProtectedConfigurationProvider")


5) Decrypt
aspnet_regiis -pd "connectionStrings" -app "/adfin"