Web.config中连接字符串的加密和解密

Web.config中连接字符串的加密和解密 
   

我们采用命令行的方式进行加密和解密。使用ASP.NET2.0提供的命令行工具aspnet_regiis.exe,该应用程序位系统目录下Microsoft.NET\Framework\版本号\文件夹中。

  • 加密:
    aspnet_regiis -pef "connectionstrings" "D:\WebSite"
    -pef:根据文件绝对路径加密,Web.config在WebSite文件夹中。
  • 解密:
    aspnet_regiis -pdf "connectionstrings" "D:\WebSite"
    -pdf:根据文件绝对路径解密,Web.config在WebSite文件夹中。

注意:加密和解密必须在同一台计算机上完成。

posted @ 2009-02-25 14:10  .来自北方的狼  阅读(268)  评论(2编辑  收藏  举报