/// <summary> /// 获取带有返回参数的Url /// </summary> /// <param name="url"></param> /// <param name="returnUrl">未通过UrlEncode的参数值</param> /// <param name="channelId"></param> /// <returns></returns> public static string GetReturnUrl(this string url, string returnUrl = "", string channelId = "") { if (string.IsNullOrEmpty(url)) { return(""); } if (!string.IsNullOrEmpty(channelId)) { url = url.GetChannelRouteUrl(channelId); } if (string.IsNullOrEmpty(returnUrl)) { try { returnUrl = HttpContext.Current.Request.RawUrl; } catch { } } if (!string.IsNullOrEmpty(returnUrl)) { returnUrl = UrlParameterHelper.UrlEncode(returnUrl); return(SpliceUrl(url, "returnUrl", returnUrl)); } return(url); }
public static string EncryptUrl(string url, string key) { if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(key)) { return(""); } string result = string.Empty; try { result = SecurityHelper.EncryptBase64XorBase64Url(url, key); if (!string.IsNullOrEmpty(result)) { result = UrlParameterHelper.UrlEncode(result); } } catch { } return(result); }