2016年5月14日 星期六

[ASP.NET] aspnet_regiis encrypt and decrypt command


l   ASPNET_REGIIS default Path :

C:\Windows\Microsoft.NET\Framework\vXXXX


l   Grant user to have the permission for the machine-level "NetFrameworkConfigurationKey" RSA key container.

aspnet_regiis –pef "NetFrameworkConfigurationKey" "Domain\UserId"

PS.  The user must have the read-permission on
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

l   Encrypt webconfig : connectionString

aspnet_regiis –pef "connectionString" "Website physical Path"


l   decrypt webconfig : connectionString

aspnet_regiis -pdf "connectionString" "Website physical Path"



l   Encrypt webconfig : system.net/mailSettings/smtp

aspnet_regiis –pef "system.net/mailSettings/smtp" "Website physical Path"


l   decrypt webconfig : system.net/mailSettings/smtp

aspnet_regiis -pdf "system.net/mailSettings/smtp" "Website physical Path"



PS. If you want to encrypt/decrypt app.config, rename it as web.config and follow the above command. After the web.config is encrypted or decrypted, copy the content and paste them to the app.config.

沒有留言:

張貼留言