我爱Aspx >> Asp.Net >> ASP.NET 2.0加密网站配置文件中的信息加密网站中的配置信息,我们不需要写任何代码,也不需要修改任何代码,只需要使用 aspnet_regiis 工具修改配置文件即可.
比如我们有下面一个配置文件需要加密:
<configuration>
<connectionStrings>
<add name="SqlServices" connectionString="Data Source=localhost;
Integrated Security=SSPI;Initial Catalog=Northwind;" />
</connectionStrings>
</configuration>
假设这个配置文件在 MyApplication 目录下。
加密命令:aspnet_regiis -pe "connectionStrings" -app "/MyApplication"
aspnet_regiis 命令在你安装的 .net Framework 目录下, 默认在:C:\WINDOWS\Microsoft.Net\Framework\v2.0.*
加密后的效果:
<configuration>
<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData> <CipherValue>0RU0XfRexc6aLFYZM+f+IWZVINqTZAAunysoVPv0dliPM72D
34MJ/gX7pzvhSJNqCLiXeyjsayse
12oAuF4rlIEraa/RHiqDKjqyJtRrRCiqnwqt5PET5LM9Q0aiT20Kpb2G2hn/0QB
Ҷƪл˵?
ASP.NET中自动给URL地址加上超链..[04-21]
ASP.NET 2.0 数据绑定高级技巧[04-21]
用ASP列出目录及文件[04-21]
用asp自动解析网页图片并保存[04-21]
ASP.NET2.0中配置文件的加密与解..[04-21]
asp.net2.0新增加的安全控件(译)[04-21]
初次体验.net Ajax无刷新技术[04-21]
Ajax基础-服务器端ASP.net脚本请..[04-21]
c#.net存储过程版本的分页[04-21]
用XenoCode 2006 加密dll (.NET混..[04-21]
ASP.NET中自动给URL地址加上超链..[04-21]
ASP.NET 2.0 数据绑定高级技巧[04-21]
使用HttpHandler实现URL重写[04-21]
用ASP列出目录及文件[04-21]
“恶搞”红色经典有罪吗?[04-21]
可乐有严重的腐蚀性![04-21]
c#文件操作的一个小例子[04-21]
c#文件操作的实际例子[04-21]
用asp自动解析网页图片并保存[04-21]
WebService上传下载文件实例[04-21]