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

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Register - Security
The Register - Security
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
量子位
C
Check Point Blog
博客园 - 【当耐特】
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
The Last Watchdog
The Last Watchdog
博客园 - Franky
N
Netflix TechBlog - Medium
Webroot Blog
Webroot Blog
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
D
Docker
S
Security Affairs
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
V2EX - 技术
V2EX - 技术
Jina AI
Jina AI
Help Net Security
Help Net Security
L
LangChain Blog
P
Proofpoint News Feed
The Cloudflare Blog
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
Schneier on Security
Schneier on Security
Recent Announcements
Recent Announcements
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
V
Vulnerabilities – Threatpost
Microsoft Security Blog
Microsoft Security Blog
H
Heimdal Security Blog
P
Proofpoint News Feed
O
OpenAI News
H
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic

博客园 - 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目录,不知道还有其它解决办法,希望大家共享一下:)