asp.net2.0中加密web.config

来源:互联网 发布:java基础目录 编辑:程序博客网 时间:2024/05/12 12:44
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
asp.net 2.0中,可以很方便地加密web.config文件里的敏感信息了.比如如果有权限操作服务器的话,
可以用下面的方法加密web.config里的敏感信息,比如要加密数据库连接串
aspnet_regiis -pe "connectionStrings" -app "/应用程序的名字"

如果没权限的话,可以在程序里动态实现

configuration config = configuration.Getwebconfiguration(Request.ApplicationPath);
configurationSection section = config.Sections["connectionStrings"];
section.ProtectSection ("DataProtectionconfigurationProvider");
config.Update ();

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击