.net 配置加密

decrpt.bat:

@echo off
Set WEB_CONFIG_PATH=D:\webconfig
Set DotNetPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

::Copy to local folder
copy %WEB_CONFIG_PATH%\Web.config Web.config /Y

:: Decrypt local Web.config
%DotNetPath%\aspnet_regiis -pdf "system.web/identity" %cd%
%DotNetPath%\aspnet_regiis -pdf "connectionStrings" %cd%
%DotNetPath%\aspnet_regiis -pdf "appSettings" %cd%

:: Backup the decrypt web.config file
set datestr=%date:/=-%
set datestr=%datestr: =-%
Set BackupFileName=Web_Dec_%datestr%.config
copy Web.config %BackupFileName% /-Y
:: backup end

PAUSE

 

encrpt.bat:

@echo off
Set WEB_CONFIG_PATH=D:\webconfig
set keyContainerName=pm_WEB_CODE
set DotNetPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

:: Encrypt local file
%DotNetPath%\aspnet_regiis -pef "system.web/identity" %cd% -prov %keyContainerName%
%DotNetPath%\aspnet_regiis -pef "connectionStrings" %cd% -prov %keyContainerName%
%DotNetPath%\aspnet_regiis -pef "appSettings" %cd% -prov %keyContainerName%

:: Authorization
%DotNetPath%\aspnet_regiis -pa %keyContainerName% "Users"


:: Update the live file
move /Y Web.config %WEB_CONFIG_PATH%

PAUSE

.net 配置加密,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。