示例#1
0
 public static void RemoveCacheAllNodeInfo()
 {
     SiteCache.RemoveByPattern(@"CK_Content_NodeInfo_NodeId_\S*");
 }
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (base.IsValid)
     {
         SiteConfigInfo config = SiteConfig.ConfigReadFromFile();
         SiteConfigInfo info2  = SiteConfig.ConfigInfo();
         bool           flag   = false;
         config.SiteOption.EnableSiteManageCode = DataConverter.CBoolean(this.RadlEnableSiteManageCode.SelectedValue);
         if (config.SiteOption.EnableSiteManageCode && string.IsNullOrEmpty(this.TxtSiteManageCode.Text.Trim()))
         {
             AdminPage.WriteErrMsg("请指定后台管理认证码!");
         }
         config.SiteOption.SiteManageCode     = this.TxtSiteManageCode.Text.Trim();
         config.SiteOption.TicketTime         = DataConverter.CLng(this.TxtTicketTime.Text.Trim());
         config.SiteOption.EnableSoftKey      = DataConverter.CBoolean(this.RadlEnableSoftKey.SelectedValue);
         config.SiteOption.ManageDir          = this.TxtManageDir.Text.Trim();
         config.SiteOption.EnableUploadFiles  = DataConverter.CBoolean(this.RadlEnableUploadFiles.SelectedValue);
         config.SiteOption.UploadFilePathRule = this.TxtUploadFilePathRule.Value;
         config.SiteOption.UploadFileMaxSize  = DataConverter.CLng(this.TxtUploadFileMaxSize.Text);
         config.SiteOption.TemplateDir        = this.TxtTemplateDir.Text.Trim();
         config.SiteOption.IncludeFilePath    = this.TxtIncludeFilePath.Text.Trim();
         config.SiteOption.IsAbsoluatePath    = DataConverter.CBoolean(this.RadlUrlType.SelectedValue);
         config.SiteOption.IsAutoSignIn       = DataConverter.CBoolean(this.RadlIsAutoSignin.SelectedValue);
         config.SiteOption.AutoSignInTime     = DataConverter.CLng(this.TxtAutoSigninTime.Text);
         config.SiteOption.RefreshQueueSize   = DataConverter.CLng(this.TxtRefreshQueueSize.Text);
         config.SiteOption.CollectionSleep    = DataConverter.CLng(this.TxtCollectionSleep.Text);
         if (info2.SiteOption.EnablePointMoneyExp != DataConverter.CBoolean(this.RadlEnablePointMoneyExp.SelectedValue))
         {
             config.SiteOption.EnablePointMoneyExp = DataConverter.CBoolean(this.RadlEnablePointMoneyExp.SelectedValue);
             flag = true;
         }
         System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~/");
         ConnectionStringsSection           section       = configuration.Sections["connectionStrings"] as ConnectionStringsSection;
         bool flag2 = false;
         if (section != null)
         {
             if (this.RadlConnProtecte.SelectedValue == "true")
             {
                 if (!section.SectionInformation.IsProtected)
                 {
                     section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
                     flag2 = true;
                 }
             }
             else if (section.SectionInformation.IsProtected)
             {
                 section.SectionInformation.UnprotectSection();
                 flag2 = true;
             }
         }
         try
         {
             string str = "";
             if (this.CheckFolder(config.SiteOption.AdvertisementDir, this.TxtADDir.Text.Trim()))
             {
                 str = "因为修改了广告目录,请去手动修改Config/QueryStirng.config中的url=\"~/IAA/ADCount.aspx\"中的IAA为新的广告目录";
             }
             this.CheckFolder(config.SiteOption.UploadDir, this.TxtUploadDir.Text.Trim());
             if (string.Compare(config.SiteOption.CreateHtmlPath, "/", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 config.SiteOption.CreateHtmlPath = string.Empty;
             }
             else
             {
                 this.CheckFolder(config.SiteOption.CreateHtmlPath, this.TxtCreateHtmlPath.Text.Trim());
             }
             config.SiteOption.CreateHtmlPath   = this.TxtCreateHtmlPath.Text.Trim();
             config.SiteOption.AdvertisementDir = this.TxtADDir.Text.Trim();
             config.SiteOption.UploadDir        = this.TxtUploadDir.Text.Trim();
             new SiteConfig().Update(config);
             SiteCache.Remove("EasyOneSiteConfig");
             if (string.Compare(this.ViewState["TemplateDir"].ToString(), config.SiteOption.TemplateDir, StringComparison.Ordinal) != 0)
             {
                 SiteCache.RemoveByPattern(@"CK_Label_\S*");
             }
             if (flag2)
             {
                 configuration.Save();
             }
             if (config.SiteOption.SiteManageCode == "8888")
             {
                 str = str + "后台管理认证码使用的是系统默认值,为了网站安全,请及时修改!";
             }
             if (config.SiteOption.ManageDir == "Admin")
             {
                 str = str + "后台管理目录名使用的是系统默认值,为了网站安全,请及时修改!";
             }
             if ((string.Compare(this.HdnManageDir.Value.Trim(), this.TxtManageDir.Text.Trim(), StringComparison.Ordinal) == 0) && !flag)
             {
                 AdminPage.WriteSuccessMsg("<font color='red'>" + str + "</font><br>网站信息配置保存成功!", "SiteOption.aspx");
             }
             else
             {
                 this.Session["IndexRightUrl"] = "Configuration/SiteOption.aspx";
                 this.Session["IndexLeftUrl"]  = "Configuration/SiteConfigGuide.aspx";
                 base.Response.Write("<script>alert('" + str + @"\n网站信息配置保存成功!'); top.location = '../../" + this.TxtManageDir.Text.Trim() + "/index.aspx';</script>");
             }
         }
         catch (FileNotFoundException)
         {
             AdminPage.WriteErrMsg("<li>文件未找到</li>", "SiteOption.aspx");
         }
         catch (UnauthorizedAccessException)
         {
             AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "SiteOption.aspx");
         }
         catch (ConfigurationErrorsException)
         {
             AdminPage.WriteErrMsg("<li>检查您的服务器是否给配置文件或文件夹写入权限。</li>", "SiteOption.aspx");
         }
     }
 }
 protected void BtnDeletePageCategory_Click(object sender, EventArgs e)
 {
     SiteCache.RemoveByPattern(@"CK_Page_Category_\S*");
     AdminPage.WriteSuccessMsg("清除节点页缓存成功!", "CacheManage.aspx");
 }
 protected void BtnDeleteNode_Click(object sender, EventArgs e)
 {
     SiteCache.RemoveByPattern(@"CK_Content_NodeInfo_\S*");
     AdminPage.WriteSuccessMsg("清除栏目缓存成功!", "CacheManage.aspx");
 }
 protected void BtnDeleteModel_Click(object sender, EventArgs e)
 {
     SiteCache.RemoveByPattern(@"CK_CommonModel_\S*");
     AdminPage.WriteSuccessMsg("清除模型缓存成功!", "CacheManage.aspx");
 }
示例#6
0
 public static void RemoveCache()
 {
     SiteCache.RemoveByPattern(@"CK_CommonModel_\S*");
 }