public void Save(cmSite site, SiteAccessRule rule, bool logChanges = true) { string filePath = HostingEnvironment.MapPath(string.Format("~/Views/{0}/.config/SiteAccessRule", site.DistinctName)); SiteAccessRule cached = HttpRuntime.Cache[filePath] as SiteAccessRule; string relativePath = "/.config/site_access_rule.setting"; string name = "Access Control"; cached = rule; HttpRuntime.Cache.Insert(filePath , cached , new CacheDependencyEx(new string[] { filePath }, false) , Cache.NoAbsoluteExpiration , Cache.NoSlidingExpiration , CacheItemPriority.NotRemovable , null ); if (logChanges) { Revisions.BackupIfNotExists(site, filePath, relativePath, name); } ObjectHelper.BinarySerialize <SiteAccessRule>(rule, filePath); if (logChanges) { Revisions.Backup(site, filePath, relativePath, name); } }
public static void Save(cmSite site, Dictionary <string, string> hostMapping) { string filePath = HostingEnvironment.MapPath(string.Format("~/Views/{0}/.config/SiteHostMapping", site.DistinctName)); string relativePath = "/.config/site_host_mapping.setting"; string name = "Host Mapping"; Revisions.BackupIfNotExists(site, filePath, relativePath, name); ObjectHelper.BinarySerialize <Dictionary <string, string> >(hostMapping, filePath); Revisions.Backup(site, filePath, relativePath, name); }
public void Save(cmSite site, SiteRestrictDomainRule rule) { string filePath = HostingEnvironment.MapPath(string.Format("~/Views/{0}/.config/SiteDomainRule", site.DistinctName)); string relativePath = "/.config/site_domain_access_rule.setting"; string name = "Domain Access Control"; Revisions.BackupIfNotExists(site, filePath, relativePath, name); ObjectHelper.BinarySerialize <SiteRestrictDomainRule>(rule, filePath); Revisions.Backup(site, filePath, relativePath, name); }
public static void SaveUrlRewriteRules(this cmSite site, Dictionary <string, string> rules) { string cacheKey = string.Format(CultureInfo.InvariantCulture , "~/Views/{0}/.config/url_rewrite.setting" , site.DistinctName ); string path = HostingEnvironment.MapPath(cacheKey); HttpRuntime.Cache.Remove(cacheKey); string relativePath = "/.config/url_rewrite.setting"; string name = "Url Rewritting"; Revisions.BackupIfNotExists(site, path, relativePath, name); ObjectHelper.XmlSerialize <Dictionary <string, string> >(rules, path); Revisions.Backup(site, path, relativePath, name); }