/// <summary> /// 获取code代码 /// </summary> /// <returns></returns> private static string GetCode(ActionExecutingContext filterContext) { var code = filterContext.RequestContext.HttpContext.GetStringFromParameters("Code"); if (!string.IsNullOrEmpty(code)) //判断code是否存在 { var cookieCode = CookieHelper.GetCookie("Code"); if (string.IsNullOrEmpty(cookieCode)) //判断是否是第二次进入 { CookieHelper.SetCookie("Code", code, DateTime.Now.AddDays(1)); //写code 保存到cookies } else { CookieHelper.DelCookies("code"); //删除cookies CodeUrl(filterContext); //code重新跳转URL } } else { CodeUrl(filterContext);//code跳转URL } return(code); }