易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET WEB.CONFIG敏感信息加密学习

今天,看到PETSHOP4.0里的WEB.CONFIG对数据库连接字符串加密,所以特意学习并记录下来。
.net 提供了 System.Configuration.RsaProtectedConfigurationProvider 。
首先配置WEB.CONFIG
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<configProtectedData>
<providers>
<clear />
<add name="KeyProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" keyContainerName="Key" useMachineContainer="true" />
</providers>
</configProtectedData>
<connectionStrings>
<add name="SQL_Northwind" connectionString="Data Source=localhost;Initial Catalog=Northwind;User ID=sa;Password=sa;" />
</connectionStrings>

</configuration>
asp.net 提供了命令行的方式,对其加密,这里我也没有具体实例,就不讲啦。
我还是按照程序的方式,新建一个页面
执行下面的方法:
 Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection("connectionStrings");
if (section != null && !section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection("KeyProvider");
config.Save();
}
方法执行后,WEB.CONFIG 文件应该有类似以下的代码出现:
 <connectionStrings configProtectionProvider="KeyProvider">
<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#">
<Encrypt


相关文档:

Building a Web 2.0 Portal with asp.net ajax 第二章

由于其致力于在一个单独页面上面提供功能,Ajax web 门户都是 Ajax 技术的杰作。在页面上提供众多的功能,同时又有服务器端和客户端良好的性能,对于架构是一个非常大的挑战。一些挑战只有在整合众多特性的 web 应用程序或者聚合其他网站内用的程序上面才有的。
本章解释了 Dropthings 的架构,你也可以在你的应用程序使用 ......

ASP.NET 3.5 MVC 架构与实战笔记6 HtmlHelper控件解析

FormExtensions类
FormExtensions类是一个静态类,定义了3种类型的扩展方法:BeginForm、BeginRouteForm、EndForm;在实际开发中,也可以使用using语句,而不需要写EndForm扩展方法。
InputExtensions类
InputExtensions类定义了5种类型的扩展方法:CheckBox,Hidden,Password,RadioButton,TextBox.

<field ......

在Web Service中使用ASP.net状态保持

原帖地址:http://www.wangchao.net.cn/bbsdetail_572426.html
      简介
  有许多聪明的办法可以解决HTTP协议的无状态问题,例如对每个请求重复发送应用程序数据包、使用HTTP认证机制来将请求映射到特定的用户、使用Cookie来存储一系列请求的状态等。在ASP.net技术中提供了 ......

asp.net操作数据库相关[导入]

使用DataRelation类创建关系并利用父/子关系读取数据示例
 void Page_Load(object sender, System.EventArgs e)
{
// 连接字符串和 SQL 语句
string ConnString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionSqlServer"];
......

ASP.NET中防止页面多次提交的代码实现

此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var o ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号