public string GetSiteDomain() { string reUrl; SiteParamConfig siteobj = SiteParam.GetConfig(Server.MapPath("/" + SiteDir + "/config/SiteParam.config")); if (string.IsNullOrEmpty(siteobj.SiteDomain)) { reUrl = siteobj.SiteRootURL; if (string.IsNullOrEmpty(reUrl)) { reUrl = "/"; } if (reUrl.Substring(reUrl.Length - 1) == "/") { reUrl = reUrl + SiteDir; } else { reUrl = reUrl + "/" + SiteDir; } } else { reUrl = siteobj.SiteDomain; } if (reUrl.Substring(reUrl.Length - 1) != "/") { reUrl = reUrl + "/"; } return(reUrl); }
protected void BindDate() { string siteLoginXml = Server.MapPath("/sysadmin/Configuraion/SiteInfoManage.config"); if (isMainDomain == false) //非主站 { dlManageDir.Visible = false; dlIsRZM.Visible = false; dlRZMCode.Visible = false; } else { string IsEnableManageCode = Utils.XmlRead(siteLoginXml, "SiteInfoManage/IsEnableManageCode", ""); string ManageDir = Utils.XmlRead(siteLoginXml, "SiteInfoManage/ManageDir", ""); string ManageCode = Utils.XmlRead(siteLoginXml, "SiteInfoManage/ManageCode", ""); if (IsEnableManageCode == "1") { this.RadTrue.Checked = true; this.txtManageCode.Text = ManageCode; } else { this.RadFalse.Checked = true; } this.txtManageDir.Text = ManageDir; } //DW API 验证码 string siteDwManage = Utils.XmlRead(siteLoginXml, "SiteInfoManage/SiteDWMange", ""); if (!string.IsNullOrEmpty(siteDwManage)) { string[] arr1 = siteDwManage.Split('|'); for (int i = 0; i < arr1.Length; i++) { string[] arr2 = arr1[i].Split(','); if (SiteID == Utils.ParseInt(arr2[0], 0)) { txtSiteDWMange.Text = arr2[2]; break; } } } else { txtSiteDWMange.Text = "360hqb"; } M_SiteParamConfig = SiteParam.GetConfig(PhyFilePath); this.txtSiteRootURL.Text = M_SiteParamConfig.SiteRootURL; this.txtSiteDir.Text = M_SiteParamConfig.SiteDir; hidSiteDir.Value = M_SiteParamConfig.SiteDir; this.txtSiteDomain.Text = M_SiteParamConfig.SiteDomain; //this.txtSiteTempletDir.Text = M_SiteParamConfig.SiteTempletDir; //this.txtDisUserName.Text = M_SiteParamConfig.DisUserName; this.ddlEditControl.SelectedValue = M_SiteParamConfig.EditControl; this.ddlLogType.SelectedValue = M_SiteParamConfig.LogType; if (!isMainDomain) { dlmainSiteDir.Attributes.Add("style", "display:none"); txtSiteDir.Enabled = false; } else { if (M_SiteParamConfig.SiteDir == "") { radMainSiteDir0.Checked = true; } else { radMainSiteDir1.Checked = true; } dlSiteDir.Visible = false; } int publishType = Utils.ParseInt(M_SiteParamConfig.PublishType, 0); if (publishType == 1) { this.radPublishType1.Checked = true; } else if (publishType == 2) { this.radPublishType2.Checked = true; } else { this.radPublishType0.Checked = true; } string fileExt = M_SiteParamConfig.CreateFileExt; switch (fileExt) { case "shtml": this.selCreateFileExt.SelectedIndex = 1; break; case "htm": this.selCreateFileExt.SelectedIndex = 2; break; case "shtm": this.selCreateFileExt.SelectedIndex = 3; break; case "aspx": this.selCreateFileExt.SelectedIndex = 4; break; } }
/// <summary> /// 保存日志:[email protected] /// </summary> /// <param Name="Content">日志内容</param> /// <param Name="PostContent">提交内容</param> /// <param Name="LogType">日志类型,1=登录日志,2=操作日志,3=错误日志</param> public void WriteLog(string Content, string PostContent, int LogType) { string ip = Utils.GetIP(); //IP地址 string ScriptName = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"] + "?" + HttpContext.Current.Request.ServerVariables["QUERY_STRING"]; //提交的页面地址 //string ScriptName = HttpContext.Current.Request.Url.ToString (); //提交的页面地址 //int urlNum = ScriptName.IndexOf(HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"]); //if (urlNum > 0) // ScriptName = ScriptName.Substring(urlNum); SiteParamConfig pci = SiteParam.GetConfig(GetSiteParamPath); if (pci.LogType == "0") //保存到数据库 { KingTop.Model.SysManage.SysLog objlog = new KingTop.Model.SysManage.SysLog(); KingTop.BLL.SysManage.SysLog objBllLog = new KingTop.BLL.SysManage.SysLog(); objlog.IP = ip; objlog.Content = Content; objlog.LogType = LogType; // objlog.NodeId = NodeId; objlog.NodeCode = NodeCode; objlog.PostContent = PostContent; objlog.ScriptName = ScriptName; objlog.SiteID = SiteID; objlog.UserNo = UserNo; objBllLog.Save("NEW", objlog); } else //保存到文件 { string logPath = pci.LogDir; StreamWriter sw = null; DateTime date = DateTime.Now; string FileName = date.Year + "-" + date.Month; if (logPath.IndexOf(":") == -1) //相对路径 { if (logPath.Trim().Length == 0) //路径为空 { logPath = "Logs"; } logPath = HttpContext.Current.Server.MapPath("~/" + logPath); } try { FileName = logPath + "/" + UserNo + "_" + FileName + "-" + DesSecurity.DesEncrypt(FileName, "hqbonline") + "-s.log"; #region 检测日志目录是否存在 if (!Directory.Exists(logPath)) { Directory.CreateDirectory(logPath); } if (!File.Exists(FileName)) { sw = File.CreateText(FileName); } else { sw = File.AppendText(FileName); } #endregion sw.WriteLine("[NodeCode] :" + NodeCode + "\r"); sw.WriteLine("[SiteID] :" + SiteID + "\r"); sw.WriteLine("[Content] :" + Content); sw.WriteLine("[AddDate] :" + date.ToString("yyyy-MM-dd hh:mm:ss") + "\r"); sw.WriteLine("[UserNo] :" + UserNo + "\r"); sw.WriteLine("[IP] :" + ip + "\r"); sw.WriteLine("[ScriptName] :" + ScriptName + "\r"); sw.WriteLine("[PostContent] :" + PostContent + "\r"); sw.WriteLine("[LogType] :" + LogType + "\r"); sw.WriteLine("≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\r"); sw.Flush(); } finally { if (sw != null) { sw.Close(); } } } }