Recently, I was asked to encrypt connection strings. Here are the codes
Encrypting
----------
@ECHO OFF
ECHO Encrypting web.config connectionStrings ...
SET target="C:\inetpub\folder\Website"
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/membership" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/roleManager" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/profile" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "system.web/machineKey" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pef "connectionStrings" %target%
ECHO Finished Encrypting web.config connectionStrings...
pause
Decrypting
----------
@ECHO OFF
ECHO Decrypting web.config connectionStrings ...
SET target="C:\inetpub\folder\Website"
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/membership" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/roleManager" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/profile" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "system.web/machineKey" %target%
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis -pdf "connectionStrings" %target%
ECHO Finished Decrypting web.config connectionStrings...
pause
No comments:
Post a Comment