日期:2011-09-01  浏览次数:20428 次

首先添加引用: using System.Web.Configuration;

加密操作如下:
private void ProtectSection(string sectionName, string provider)
    
{
        Configuration config 
=
            WebConfigurationManager.
                OpenWebConfiguration(Request.ApplicationPath);

        ConfigurationSection section 
= config.GetSection(sectionName);

        
if (section != null && !section.SectionInformation.IsProtected)