以下是在没有任何编程的情况下加密web.config文件的命令...
加密命令:
aspnet_regiis -pef "Section" "Path exluding web.config"
用于解密
aspnet_regiis -pdf "Section" "Path exluding web.config"
通过这些命令,您可以加密或解密整个部分。
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
找到 aspnet_regiis.exe。在 Windows 命令提示符 (cmd) 中执行 aspnet_regis.exe。您可以使用 "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe" -pdf "Section" "不包括 web.config 的路径"
。 - Icad在您的框架目录中使用aspnet_regiis工具:
-- CONFIGURATION ENCRYPTION OPTIONS --
pe section Encrypt the configuration section. Optional arguments:
[-prov provider] Use this provider to encrypt.
[-app virtual-path] Encrypt at this virtual path. Virtual path must begin with a forward slash.
If it is '/', then it refers to the root of the site. If -app is not specified, the root
web.config will be encrypted.
[-site site-name-or-ID] The site of the virtual path specified in -app. If not specified, the
default web site will be used.
[-location sub-path] Location sub path.
[-pkm] Encrypt/decrypt the machine.config instead of web.config.
pd section Decrypt the configuration section. Optional arguments:
[-app virtual-path] Decrypt at this virtual path. Virtual path must begin with a forward slash.
If it is '/', then it refers to the root of the site. If -app is not specified, the root
web.config will be decrypted.
[-site site-name-or-ID] The site of the virtual path specified in -app. If not specified, the
default web site will be used.
[-location sub-path] Location sub path.
[-pkm] Encrypt/decrypt the machine.config instead of web.config.
使用 aspnet_regiis.exe 命令行工具
您还可以使用 aspnet_regiis.exe 命令行工具对 Web.config 文件中的部分进行加密和解密,该工具位于 %WINDOWSDIR%\Microsoft.Net\Framework\version 目录中。
请参阅此处:https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx。