//public string UrlRef //{ // get // { // string _urlRef = ""; // if (!string.IsNullOrEmpty(Request.QueryString["urlref"]))//多图上传 // { // _urlRef = Request.QueryString["urlref"].ToLower(); // } // else // { // _urlRef = Request.UrlReferrer == null ? "" : Request.UrlReferrer.ToString().ToLower(); // } // return _urlRef; // } //} //private bool IsBar() //{ // bool flag = false; // if (!string.IsNullOrEmpty(UrlRef)) // { // flag = (UrlRef.Contains("/pclass?") || UrlRef.Contains("/pitem?") || UrlRef.Contains("/editcontent?")); // } // return flag; //} private M_GuestBookCate GetBarModel(UploadConfig config) { M_GuestBookCate model = null; B_Guest_Bar barBll = new B_Guest_Bar(); if (config.SourceUrl.Contains("/pclass?")) { int cateid = DataConverter.CLng(StrHelper.GetValFromUrl(config.SourceUrl, "id")); model = cateBll.SelReturnModel(cateid); } else { int cateid = 0; int postid = DataConverter.CLng(StrHelper.GetValFromUrl(config.SourceUrl, "cateid")); if (postid > 0) { cateid = barBll.SelCateIDByPost(postid); } else { cateid = DataConverter.CLng(StrHelper.GetValFromUrl(config.SourceUrl, "cateid")); } model = cateBll.SelReturnModel(cateid); } return(model); }
public IActionResult ASCXLoad(string name) { if (string.IsNullOrEmpty(name)) { return(Content("")); } C_Model model = new C_Model(); model.mode = StrHelper.GetValFromUrl(name, "mode"); model.value = StrHelper.GetValFromUrl(name, "value"); string cshtmlName = name.Split('?')[0].Replace(".ascx", ""); //检测当前页面是否有缓存,无则重新加载 return(PartialView("~/Areas/Admin/Views/Shared/" + cshtmlName + ".cshtml", model)); }
/// <summary> /// 获取GET提交 /// </summary> /// <param name="html">模板html</param> /// <returns></returns> public string GetRequest(string html) { string pattern = @"\{\$GetRequest\([a-z0-9]*\)\$\}";//{$GetRequest(变量名)$} string url = rawurl.ToLower(); string query = url.Contains("?") ? url.Split('?')[1] : ""; MatchCollection matchs = Regex.Matches(html, pattern, RegexOptions.IgnoreCase); for (int i = 0; i < matchs.Count; i++) { MatchCollection Smallmatchs = Regex.Matches(matchs[i].ToString(), pattern, RegexOptions.IgnoreCase); foreach (Match Smallmatch in Smallmatchs) { string requesttxt = (Smallmatch.ToString().Replace(@"{$GetRequest(", "").Replace(@")$}", "") ?? "").ToLower();//变量名 string result = ""; try { //从query中取值 result = StrHelper.GetValFromUrl(url, requesttxt); //如为空,则检测是否为路由页面 /Shop/1 /Item/1 if (string.IsNullOrEmpty(result) && (requesttxt.Equals("id") || requesttxt.Equals("itemid"))) { result = GetIDVal(url); } // /class_1/default if (string.IsNullOrEmpty(result) && requesttxt.Equals("nodeid")) { result = Regex.Split(url, Regex.Escape("class_"))[1].Split('/')[0]; } result = SafeValue(result); //ZLLog.L(url + "|" + result + "|" + Smallmatchs[0].Value); } catch (Exception ex) { ZLLog.L(Model.ZLEnum.Log.exception, ex.Message); } result = HttpUtility.HtmlEncode(result); if (!string.IsNullOrEmpty(result) && SafeSC.CheckData(result)) { result = ""; ZLLog.L(ZLEnum.Log.safe, "GetRequest:" + result); } html = html.Replace(Smallmatch.ToString(), result); } } return(html); }