protected void Page_Load(object sender, EventArgs e) { string CookieName = ""; string token = ""; string CustID = ""; string RealName = ""; string UserName = ""; string NickName = ""; string OuterID = ""; string CustType = ""; string AuthenName = ""; string AuthenType = ""; string RedirectUrl = ""; string key = ""; string ErrMsg = ""; int Result = ErrorDefinition.IError_Result_UnknowError_Code; if (!this.IsPostBack) { CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"]; token = PageUtility.GetCookie(CookieName); if (String.IsNullOrEmpty(token)) { Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=请先登录积分商城", true); return; } UserToken UT = new UserToken(); key = System.Configuration.ConfigurationManager.AppSettings["ScoreSystemSecret"]; Result = UT.ParseScoreUserToken(token, key, out ProvinceID, out CustID, out RealName, out UserName, out NickName, out OuterID, out CustType, out AuthenName, out AuthenType, out ErrMsg); if (Result == 0) { string par_ProvinceID = Request["ProvinceID"]; if (par_ProvinceID.Equals(ProvinceID)) { String Ticket = CommonBizRules.CreateTicket(); Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, NickName, UserName, OuterID, "", AuthenName, AuthenType, out ErrMsg); if (Result != 0) { Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=票据生成失败,请重新登录积分商城", true); return; // 重定向至哪里 } // 根据ProvinceID 查出 Redirecturl Result = CIP2BizRules.GetRedirectUrlByProvince(ProvinceID, out RedirectUrl, out ErrMsg); if (Result == 0) { if (!String.IsNullOrEmpty(RedirectUrl)) { if (RedirectUrl.IndexOf("?") > 0) { RedirectUrl = RedirectUrl + "&Ticket=" + Ticket; } else { RedirectUrl = RedirectUrl + "?Ticket=" + Ticket; } } else { // 根据provinvce 获取redirecturl 为空 ,该转向哪里 Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=未配置该省的返回地址", true); } } else { // 根据province获得url失败,该返回哪里? Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=根据省ID获取返回地址失败", true); } Response.Redirect(RedirectUrl, true); } else { Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=省ID不匹配当前token中的省ID", true); } } else // token 存在但是解析失败 { RedirectUrl = Request.Url.AbsoluteUri; Response.Redirect(RedirectUrl, true); } } }