惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
Recent Announcements
Recent Announcements
C
Check Point Blog
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
爱范儿
爱范儿
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
云风的 BLOG
云风的 BLOG
月光博客
月光博客
AI
AI
美团技术团队
SecWiki News
SecWiki News
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
Cybersecurity and Infrastructure Security Agency CISA
M
MIT News - Artificial intelligence
PCI Perspectives
PCI Perspectives
aimingoo的专栏
aimingoo的专栏
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Visual Studio Blog
T
The Exploit Database - CXSecurity.com
小众软件
小众软件
N
News | PayPal Newsroom
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
MongoDB | Blog
MongoDB | Blog
H
Heimdal Security Blog
Schneier on Security
Schneier on Security
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
D
Docker
Spread Privacy
Spread Privacy
Cloudbric
Cloudbric
www.infosecurity-magazine.com
www.infosecurity-magazine.com
I
Intezer
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
AWS News Blog
AWS News Blog

博客园 - kary

VS 2005 Web Deployment Projects GridView绑定数据源,无记录时表头也显示的一种解决方法 Web Deployment Projects with Visual Studio 2005 快速排序与二分查找算法Javascript版本 - kary - 博客园 随页面移动的浮动广告代码 - kary - 博客园 MSDN转:自定义实体类简介 aspnet2.0 Menu控件上传到服务器小问题 ASP.NET2.0的快速入门站点 AJAX开发简略 用人之道(二)-- 何管理软件开发团队 转:用人之道(一)-- 如何组建软件开发队伍 袁峰写的开发之路 雅虎公司C#笔试题 转:产品开发模式管理网站开发 Windows IIS 6安全保护贴—URL授权全攻略! Access库的小问题 要做互联星空的SP接口,一点头绪都没有 windows server 2003 出错提示"请求的资源在使用中"解决方案 针对SQL INJECTION的SQL SERVER安全设置初级篇
asp.net2.0如何加密数据库联接字符串 - kary - 博客园
kary · 2006-05-19 · via 博客园 - kary

asp.net2.0如何加密数据库联接字符串
在asp.net2.0中,发布网站时,加密web.config,这样可以有效保证数据库用户和密码安全,其步骤如下:

1.添加密钥
执行:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pc "hnlaw" -exp
其中"hnlaw"为密钥名称

2.添加web.config节点
在web.config的<configuration></configuration>之间添加:
<configProtectedData>
  <providers>
    <add keyContainerName="hnlaw" useMachineContainer="true" description="Uses RsaCryptoServiceProvider to encrypt and

decrypt" name="hnlaw" type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration, Version=2.0.0.0,

Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
</configProtectedData>
注意:这里keyContainerName="hnlaw"和name="hnlaw"分别表示你的密钥名称;

3.加密web.config
 到网站根目录添加一个批处理文件enweb.bat,内容如下:
 @echo off
 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pef "system.web/identity" "E:\HS  Studio\Donet2\Hnlawyer" -prov

"hnlaw"
  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pef "connectionStrings" "E:\HS  Studio\Donet2\Hnlawyer" -prov

"hnlaw"
PAUSE
注册上面的的路径和名称!
运行后出现成功!
4.解密
同样到网站根目录添加一个批处理文件deweb.bat,内容如下:
 @echo off
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pef "system.web/identity" "E:\HS  Studio\Donet2\Hnlawyer"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pdf "connectionStrings" "E:\HS  Studio\Donet2\Hnlawyer"
PAUSE

最后就是要注意:做完后找到C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys目录下,找到生成

的密钥文件(可按时间查找),给上network service可读取权限,不然会出现Error message from the provider: The RSA key container could

not be opened.
无法读取

这样可能会出现,如果没有自己的服务器,没有权限修改MachineKeys目录,不知道还有其它解决办法,希望大家共享一下:)