public static string ResolveCurrentUrl(string url) { if (CurrentUrl.EndsWith("/")) { return(ResolveUrl("~/" + CurrentUrl + url)); } return(ResolveUrl("~/" + CurrentUrl + "/" + url)); }
protected override void OnInit(EventArgs e) { if (!CurrentUrl.EndsWith("/Login.aspx")) { if (CurrentAdmin == null) { Response.Write("<script>alert('连接超时!');parent.window.location.href='../Master/Login.aspx';</script>"); Response.End(); } else { //Sys只有超管可以访问 if (CurrentUrl.Contains("/Sys/") && !CurrentAdmin.IsSuper) { Response.Write("<script>alert('没有访问的权限!');history.go(-1);</script>"); Response.End(); } } } base.OnInit(e); }
/// <summary> /// GetComment /// </summary> /// <returns></returns> private IDictionary <string, string> GetComment() { var dic = new Dictionary <string, string>(); var refer = CurrentUrl.EndsWith("/") ? CurrentUrl : $"{CurrentUrl}/"; var url = $"{refer}event/app/winport_bsr/getBsrData.htm"; //var url = "https://shop1397148954914.1688.com/event/app/winport_bsr/getBsrData.htm"; var httpHelper = new HttpHelper { Cookies = $"cna={GetCna()}", Referer = CurrentUrl }; var html = httpHelper.GetHtmlByPost(url, $"site_id=winport&page_type=index&_csrf_token={GetRandom32()}&site_key={GetRandom32()}"); var jArray = JArray.Parse(JObject.Parse(html)["result"]["bsrDataList"].ToString()); var Comment_MatchDescripRate = jArray[0]?["compareLineRate"]?.ToString().Replace("%", string.Empty); if (Comment_MatchDescripRate == "-1") { Comment_MatchDescripRate = string.Empty; } else if (Comment_MatchDescripRate == "0") { Comment_MatchDescripRate = "0"; } else { var compareTag = int.Parse(jArray[0]?["compareTag"]?.ToString() ?? "0"); Comment_MatchDescripRate = compareTag == -1 ? $"-{Comment_MatchDescripRate}" : $"+{Comment_MatchDescripRate}"; } var Comment_ServiceStatueRate = jArray[1]?["compareLineRate"]?.ToString().Replace("%", string.Empty); if (Comment_ServiceStatueRate == "-1") { Comment_ServiceStatueRate = string.Empty; } else if (Comment_ServiceStatueRate == "0") { Comment_ServiceStatueRate = "0"; } else { var compareTag = int.Parse(jArray[1]?["compareTag"]?.ToString() ?? "0"); Comment_ServiceStatueRate = compareTag == -1 ? $"-{Comment_ServiceStatueRate}" : $"+{Comment_ServiceStatueRate}"; } var Comment_ShipSpeedRate = jArray[2]?["compareLineRate"]?.ToString().Replace("%", string.Empty); if (Comment_ShipSpeedRate == "-1") { Comment_ShipSpeedRate = string.Empty; } else if (Comment_ShipSpeedRate == "0") { Comment_ShipSpeedRate = "0"; } else { var compareTag = int.Parse(jArray[2]?["compareTag"]?.ToString() ?? "0"); Comment_ShipSpeedRate = compareTag == -1 ? $"-{Comment_ShipSpeedRate}" : $"+{Comment_ShipSpeedRate}"; } dic.Add("Comment_MatchDescripRate", Comment_MatchDescripRate); dic.Add("Comment_ServiceStatueRate", Comment_ServiceStatueRate); dic.Add("Comment_ShipSpeedRate", Comment_ShipSpeedRate); return(dic); }
private bool ItemHasCurrentUrl(PaginationItemTagHelper item) { ; return(CurrentUrl.EndsWith("/" + item.Href.Trim('/'), StringComparison.CurrentCultureIgnoreCase) || CurrentUrl.Equals(item.Href, StringComparison.CurrentCultureIgnoreCase)); }