Exemple #1
0
        public static SiteConfigInfo ConfigInfo()
        {
            SiteConfigInfo info = SiteCache.Get("CK_System_SiteConfigInfo") as SiteConfigInfo;

            if (info == null)
            {
                info = ConfigReadFromFile();
                SiteCache.Insert("CK_System_SiteConfigInfo", info, new System.Web.Caching.CacheDependency(new SiteConfig().FilePath));//  将new CacheDependency(new SiteConfig().FilePath)); 删除了new CacheDependency
            }
            if (info == null)
            {
                info = new SiteConfigInfo();
            }
            return(info);
        }
Exemple #2
0
 public void Update(SiteConfigInfo config)
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(SiteConfigInfo));
         using (Stream stream = new FileStream(this.filePath, FileMode.Create, FileAccess.Write, FileShare.None))
         {
             XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
             namespaces.Add("", "");
             serializer.Serialize(stream, config, namespaces);
         }
     }
     catch (SecurityException exception)
     {
         throw new SecurityException(exception.Message, exception.DenySetInstance, exception.PermitOnlySetInstance, exception.Method, exception.Demanded, exception.FirstPermissionThatFailed);
     }
 }