/// <summary> /// 去掉URL中的令牌 /// 重新登录验证 /// </summary> /// <returns></returns> private string replaceToken() { string url = Request.Url.AbsoluteUri; url = Regex.Replace(url, @"(\?|&)Token=.*", "", RegexOptions.IgnoreCase); //return "{0}?BackURL={1}".WithFormat(AccountLogin, Server.UrlEncode(url)); return(JStringFormat.WithFormat("{0}?BackURL={1}", AccountLogin, Server.UrlEncode(url))); //return "http://www.passport.com/userlogin.aspx?BackURL=" + Server.UrlEncode(url); }
/// <summary> /// 获取带令牌请求的URL /// </summary> /// <returns></returns> private string getTokenURL() { string url = Request.Url.AbsoluteUri; Regex reg = new Regex(@"^.*\?.+=.+$"); if (reg.IsMatch(url)) { url += "&Token=$Token$"; } else { url += "?Token=$Token$"; } //return "{0}?BackURL={1}".WithFormat(GetToken, Server.UrlEncode(url)); return(JStringFormat.WithFormat("{0}?BackURL={1}", GetToken, Server.UrlEncode(url))); //return "http://www.passport.com/gettoken.aspx?BackURL=" + Server.UrlEncode(url); }