ASP.NET 2.0 中一种新的方法实现对配置文件的加密
2007-05-20 17:37
1031 查看
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
string command = e.CommandName;
string path = e.CommandArgument.ToString();
if (path != "appSettings" && path != "connectionStrings")
path = "system.web/" + path;
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection(path);
if (command == "Encrypt")
{
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
config.Save();
}
else if (command == "Decrypt")
{
section.SectionInformation.UnprotectSection();
config.Save();
}
}
{
string command = e.CommandName;
string path = e.CommandArgument.ToString();
if (path != "appSettings" && path != "connectionStrings")
path = "system.web/" + path;
Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
ConfigurationSection section = config.GetSection(path);
if (command == "Encrypt")
{
section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
config.Save();
}
else if (command == "Decrypt")
{
section.SectionInformation.UnprotectSection();
config.Save();
}
}
相关文章推荐
- ASP.NET 2.0加密Web.config 配置文件
- ASP.NET 2.0加密网站配置文件中的信息
- ASP.NET 2.0加密解密Web.config配置文件
- asp.net 2.0 中加密web.config 文件中的配置节
- ASP.NET 2.0加密Web.config 配置文件
- ASP.NET 2.0加密Web.config 配置文件
- Asp.Net 2.0加密Web.config配置文件
- ASP.NET 2.0加密Web.config 配置文件 (终极版)
- ASP.NET 2.0加密Web.config 配置文件
- ASP.NET 2.0加密Web.config 配置文件
- asp.net 2.0 中加密web.config 文件中的配置节
- ASP.NET 2.0加密Web.config 配置文件
- asp.net 2.0 中加密web.config 文件中的配置节
- ASP.NET 2.0加密Web.config 配置文件
- ASP.NET 2.0加密Web.config 配置文件
- ASP.NET 2.0中,对网站配置文件(web.cofig)进行加密(摘)
- ASP.NET 2.0加密Web.config 配置文件
- ASP.NET 2.0加密Web.config 配置文件
- asp.net 2.0 中加密web.config 文件中的配置节
- asp.net 2.0 中加密web.config 文件中的配置节