数据库连接加密

 Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
            ConfigurationSection configSection = config.GetSection("connectionStrings");
            if (configSection.SectionInformation.IsProtected)
            {
                //如果已经加密,就不用再加密了
                Label1.Text = "已经加密!";
            }
            else
            {
                configSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
                config.Save();
                Label1.Text = "加密成功!";
            }

你可能感兴趣的:(数据库连接)