/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); string UAProvinceID = ""; string SourceType = ""; //string ReturnURL = ""; try { if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnUrl, out ErrMsg); this.HiddenField_SPID.Value = SPID; strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnUrl)); } else { //this.errorHint.InnerText = "SPTokenRequest参数缺失"; return; } } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); try { String reg_url = System.Configuration.ConfigurationManager.AppSettings["YgMobileReturnURL"]; if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnURL, out ErrMsg); strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnURL)); } else { this.errorHint.InnerText = "SPTokenRequest参数缺失"; return; } } catch (System.Exception ex) { strLog.Append(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { string UAProvinceID = ""; string SourceType = ""; if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 log("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnUrl, out ErrMsg); //日志 log(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnUrl)); if (Result != 0) { errorHint.InnerHtml = "请求参数SPTokenRequest不正确"; return; } if (!CommonUtility.ValidateUrl(ReturnUrl.Trim())) { errorHint.InnerHtml = "请求参数ReturnURL不正确"; return; } } }
protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseBesttoneAccountPageRequest(SPTokenRequest, this.Context, out SPID, out CustID, out HeadFooter, out ReturnUrl, out ErrMsg); if (!String.IsNullOrEmpty(CustID)) { this.custidtxt.Value = CustID; } if (!String.IsNullOrEmpty(ReturnUrl)) { this.returnurltxt.Value = ReturnUrl; } if (!String.IsNullOrEmpty(SPID)) { this.spidtxt.Value = SPID; } strLog.AppendFormat("SPID:{0};CustID:{1};HeadFooter:{2};ReturnUrl:{3};ErrMsg:{4}", SPID, CustID, HeadFooter, ReturnUrl, ErrMsg); } log(strLog.ToString()); }
/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); try { String reg_url = System.Configuration.ConfigurationManager.AppSettings["YgMobileReturnURL"]; // 这里最好不要配置,应该动态 if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnURL, out ErrMsg); strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnURL)); } else { ErrMsg = "缺少参数SPTokenRequest!"; Response.Redirect("ErrorInfo.aspx?Result=-1001" + "&ErrorInfo=" + ErrMsg + "&FunctionName=缺少参数SPTokenRequest", true); return; } } catch (System.Exception ex) { strLog.Append(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); try { if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnURL, out ErrMsg); //日志 strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}\r\n", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnURL)); } } catch (System.Exception ex) { strLog.AppendFormat(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 解析请求参数 /// </summary> protected void ParseSPTokenRequest() { try { if (HttpContext.Current.Request["SPTokenRequest"] != null) { String SPTokenRequest = HttpContext.Current.Request["SPTokenRequest"]; String ErrMsg = String.Empty; String tempCustID = String.Empty; Int32 Result = SSOClass.ParseBesttoneAccountPageRequest(SPTokenRequest, this.Context, out _spid, out tempCustID, out _isNeedHeadFoot, out _returnUrl, out ErrMsg); if (Result != 0) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "请求参数有误", this.Context); return; } if (tempCustID != base.CustID) { CommonBizRules.ErrorHappenedRedircet(result, ErrMsg, "登录信息有误,请重新登录", this.Context); return; } } } catch { } }
protected void ParseSPTokenRequest() { if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 log("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseBesttoneAccountPageRequest(SPTokenRequest, this.Context, out SPID, out CustID, out HeadFooter, out ReturnUrl, out ErrMsg); //日志 log(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},CustID:{3},HeadFooter:{4},stamp:{5},ReturnUrl:{6}", Result, ErrMsg, SPID, CustID, HeadFooter, stamp, ReturnUrl)); } }
protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseBesttoneAccountPageRequestM(SPTokenRequest, this.Context, out SPID, out CustID, out ReturnUrl, out ErrMsg); this.HiddenField_CUSTID.Value = CustID; this.HiddenField_SPID.Value = SPID; this.HiddenField_URL.Value = ReturnUrl; } }
protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseBesttoneAccountPageRequest(SPTokenRequest, this.Context, out SPID, out CustID, out HeadFooter, out ReturnUrl, out ErrMsg); this.HiddenField_SPID.Value = SPID; //日志 strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},CustID:{3},HeadFooter:{4},stamp:{5},ReturnUrl:{6}", Result, ErrMsg, SPID, CustID, HeadFooter, stamp, ReturnUrl)); } log(strLog.ToString()); }
protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseBesttoneAccountPageRequest(SPTokenRequest, this.Context, out SPID, out CustID, out HeadFooter, out ReturnUrl, out ErrMsg); String t_CustID = CustID; String t_SPID = SPID; String t_ReturnUrl = ReturnUrl; t_ReturnUrl = ReturnUrl; } }
protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); try { if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnURL, out ErrMsg); //日志 strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnURL)); if (Result != 0) { //errorHint.InnerHtml = "请求参数SPTokenRequest不正确"; } if (!CommonUtility.ValidateUrl(ReturnURL.Trim())) { //errorHint.InnerHtml = "请求参数ReturnURL不正确"; } } else { // 缺少参数 SPTokenRequest SPTokenRequest = "35433333%24dqS%2BhL04fl53JX5nAN7zsMtH8iUrZAg6OAvGImW0XvlceX36EB%2Flki%2BTx6GQAbC%2F7fwXuoU4M68G%0ACOcdPBCsXRIvwwjzkK8f%2BvZXOuZU0mgYNYRTyVxpm6Olgj7wN8Yqno3VZ14RwXYfyMZ0rqUXEHaR%0ATWPyEFCvsc54PR6i9nGnnJyyDTVszg%3D%3D"; } } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 log("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnURL, out ErrMsg); //日志 log(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnURL)); if (Result != 0) { err_code.InnerHtml = "请求参数SPTokenRequest不正确"; } if (!CommonUtility.ValidateUrl(ReturnURL.Trim())) { err_code.InnerHtml = "请求参数ReturnURL不正确"; } string SignUpReturnUrl = HttpUtility.UrlEncode(SPTokenRequest); SignUpReturnUrl = "SPTokenRequest=" + SignUpReturnUrl; if (CommonUtility.IsParameterExist("NeedLogin", this.Page)) { SignUpReturnUrl = SignUpReturnUrl + "&NeedLogin="******"NeedLogin"]); } SignUpReturnUrl = HttpUtility.UrlEncode(this.Context.Request.Url.ToString().Substring(0, this.Context.Request.Url.ToString().IndexOf("?") + 1) + SignUpReturnUrl); this.linkU1.HRef = "../signup.aspx?SPID=" + SPID + "&ReturnUrl=" + SignUpReturnUrl; this.linkU2.HRef = "../signup.aspx?SPID=" + SPID + "&ReturnUrl=" + SignUpReturnUrl; } }
/// <summary> /// 判断并解析SPTokenRequest参数 /// </summary> protected void ParseSPTokenRequest() { StringBuilder strLog = new StringBuilder(); try { String reg_url = System.Configuration.ConfigurationManager.AppSettings["YgRegisterTargetURL"]; if (CommonUtility.IsParameterExist("SPTokenRequest", this.Page)) { SPTokenRequest = Request["SPTokenRequest"]; //日志 strLog.AppendFormat("【SPTokenRequest参数】:" + SPTokenRequest); //解析请求参数 Result = SSOClass.ParseLoginRequest(SPTokenRequest, this.Context, out SPID, out UAProvinceID, out SourceType, out ReturnURL, out ErrMsg); //日志 strLog.AppendFormat(String.Format("【解析参数结果】:Result:{0},ErrMsg:{1},SPID:{2},ProvinceID:{3},SourceType:{4},ReturnURL:{5}", Result, ErrMsg, SPID, UAProvinceID, SourceType, ReturnURL)); if (Result != 0) { errorHint.InnerHtml = "请求参数SPTokenRequest不正确"; } if (!CommonUtility.ValidateUrl(ReturnURL.Trim())) { errorHint.InnerHtml = "请求参数ReturnURL不正确"; } string SignUpReturnUrl = HttpUtility.UrlEncode(SPTokenRequest); SignUpReturnUrl = "SPTokenRequest=" + SignUpReturnUrl; if (CommonUtility.IsParameterExist("NeedLogin", this.Page)) { SignUpReturnUrl = SignUpReturnUrl + "&NeedLogin="******"NeedLogin"]); } SignUpReturnUrl = HttpUtility.UrlEncode(this.Context.Request.Url.ToString().Substring(0, this.Context.Request.Url.ToString().IndexOf("?") + 1) + SignUpReturnUrl); int startIndex = ReturnURL.IndexOf("url="); string tmp_url = ReturnURL.Substring(startIndex + 4); // tmp_url = aHR0cDovL3d3dy5iZXN0dG9uZS5jbg== strLog.AppendFormat(String.Format("url={0}", tmp_url)); String _url = System.Text.UTF8Encoding.Default.GetString(FromBase64String(tmp_url)); // _url = http://www.besttone.cn strLog.AppendFormat(String.Format("url={0}", tmp_url)); strLog.AppendFormat(String.Format("_url={0}", _url)); reg_url = reg_url + "?returnUrl=" + _url; // reg_url = http://sso.besttone.cn/SSO/registerV2.action?returnUrl=http://www.besttone.cn http://sso.besttone.cn/SSO/registerV2.action 从配置文件中 strLog.AppendFormat("reg_url=" + reg_url); this.linkU1.NavigateUrl = reg_url; } else { this.linkU1.NavigateUrl = reg_url + "?SPID=35000000&ReturnUrl=http://www.118114.cn"; } this.linkU1.Target = "_top"; } catch (System.Exception ex) { log(ex.ToString()); } finally { log(strLog.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { log("step1"); int Result = ErrorDefinition.IError_Result_UnknowError_Code; log("step2"); if (CommonUtility.IsParameterExist("SSORequestXML", this.Page)) // 带着token过来的是网厅的认证请求 { #region 隐藏 MBOSSClass mboss = new MBOSSClass(); SPInfoManager spInfo = new SPInfoManager(); string SPID = "35999991"; string UAProvinceID = "35"; string SourceType = ""; string uaURL = ""; string privateKeyPassword = ""; string UserName = ""; string ErrMsg = ""; string CAP01002_XML = Request["SSORequestXML"]; string DigitalSign = MBOSSClass.GetNewXML(CAP01002_XML, "DigitalSign"); string DigitalSignValue = MBOSSClass.GetValueFromXML(CAP01002_XML, "DigitalSign"); //从中取出RedirectURL string RedirectURL = MBOSSClass.GetValueFromXML(CAP01002_XML, "RedirectURL"); //验证 CAP01002_XM 合法性 byte[] PublicKeyFile = new byte[0]; try { Object SPData = spInfo.GetSPData(this.Context, ""); //SPDataCacheName 这里要去问tongbo PublicKeyFile = spInfo.GetCAInfo(SPID, 0, SPData, out UserName, out privateKeyPassword); } catch (Exception err) { //验证签名未通过 ErrMsg = err.Message; Result = -20001; Response.Redirect(RedirectURL, true); return; } Result = mboss.VerifySignByPublicKey(DigitalSign, PublicKeyFile, DigitalSignValue, out ErrMsg); //<CAPRoot><SessionHeader><ServiceCode>CAP01003</ServiceCode><Version>mbossUacVersion1</Version><ActionCode>0</ActionCode><TransactionID>35000201109254969771818</TransactionID><SrcSysID>35000</SrcSysID><DigitalSign>302C02141DB53BC5D52562D69EFD959B32F6E10D4BF6421E02145983D67CC81B0F376CA688B39F6AD1896EA0E082</DigitalSign><DstSysID>18</DstSysID><ReqTime>20110925000030</ReqTime><Request><ReqType/><ReqCode/><ReqDesc/></Request></SessionHeader><SessionBody><SPSSOAuthReq><RedirectURL>http://Customer.besttone.com.cn/UserPortal/SSO/SelectAssertion.aspx</RedirectURL><AcceptAccountTypeList><AcceptAccountType>0000000</AcceptAccountType></AcceptAccountTypeList></SPSSOAuthReq></SessionBody></CAPRoot> log("从网厅来:" + CAP01002_XML); if (Result != 0) { // 签名校验未通过,直接将请求原路打回 Response.Redirect(RedirectURL, true); return; } string sessionid = this.Page.Session.SessionID; string globaltoken = Request.Cookies[sessionid].Value.ToString(); uaURL = RedirectURL; if (globaltoken != null && !"".Equals(globaltoken)) { this.sendTicket2UA(uaURL); } else { this.Response.Redirect(uaURL); } #endregion } else { //不带token的是积分商城过来的认证请求 string direction = Request["Direction"]; string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"]; string key0 = System.Configuration.ConfigurationManager.AppSettings["ScoreSystemSecret"]; if (CommonUtility.IsParameterExist("Direction", this.Page)) { #region 反向登录到集团网厅方向 string ProvinceID = Request["ProvinceID"]; if ("uam".Equals(direction)) { //获取本地的token,如果没有token则返回到积分商城登录 //string token = Request.Cookies[CookieName].Value; String token = PageUtility.GetCookie(CookieName); if (String.IsNullOrEmpty(token)) { Response.Redirect("http://www.ct10000.com"); } string ProvinceID0 = ""; // 2013.01.23 添加 string CustID0 = ""; string RealName0 = ""; string UserName0 = ""; string NickName0 = ""; string OuterID0 = ""; string CustType0 = ""; string AuthenName0 = ""; string AuthenType0 = ""; string ErrMsg0 = ""; //解析token UserToken UT0 = new UserToken(); // 2013.01.23 修改 //int Result0 = UT0.ParseUserToken(token, key0, out CustID0, out RealName0, out UserName0, out NickName0, out OuterID0, out CustType0, out AuthenName0, out AuthenType0, out ErrMsg0); int Result0 = UT0.ParseScoreUserToken(token, key0, out ProvinceID0, out CustID0, out RealName0, out UserName0, out NickName0, out OuterID0, out CustType0, out AuthenName0, out AuthenType0, out ErrMsg0); //日志 log(String.Format("【token解析结果:】Result:{0},ErrMsg:{1},AuthenName:{2},AuthenType:{3},CustID:{4},OuterID:{5},CustType:{6}", Result0, ErrMsg0, AuthenName0, AuthenType0, CustID0, OuterID0, CustType0)); if (Result0 == 0) { //生成ticket,反向单点登录要求ticket前面加上省id //string sDate = DateTime.Now.ToString("yyyyMMddHHmmssfff"); //Random r = new Random(); //string ticket = ProvinceID + sDate + r.Next(10000, 99999).ToString(); string ticket = ProvinceID + CommonBizRules.CreateTicket(); //积分商城 SPID = "35000010"; //将ticket插入数据库 Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID0, RealName0, NickName0, UserName0, OuterID0, "", AuthenName0, AuthenType0, out ErrMsg0); log(String.Format("【ticket生成结果:{0}】Result:{1},ErrMsg:{2},ticket:{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Result, ErrMsg0, ticket)); if (Result != 0) { this.Response.Redirect("http://www.ct10000.com"); } string uamURL = System.Configuration.ConfigurationManager.AppSettings["UAMUrl"] + "?AccountIndex=" + ticket; log(String.Format("【登录网厅:{0}】uamURL:{1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), uamURL)); this.Response.Redirect(uamURL); } else { this.Response.Redirect("http://www.ct10000.com"); } } else { this.Response.Redirect("http://www.ct10000.com"); } #endregion } else { if (!this.IsPostBack) { #region 积分商城直接登录 string SPTokenRequest = Request["SPTokenRequest"]; log(String.Format("【SPTokenRequest参数为:{1}】SPTokenRequest:{0}", SPTokenRequest, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); string key = System.Configuration.ConfigurationManager.AppSettings["ScoreSystemSecret"]; string JFLoginUrl = System.Configuration.ConfigurationManager.AppSettings["JFLoginUrl"]; //生成全局token写入cookie,该全局token为了将来网厅请求时候,查询该客户登陆状态用 UserToken UT = new UserToken(); ProvinceID = Request["ProvinceID"]; AuthenType = Request["AuthenType"]; AuthenName = Request["AuthenName"]; Password = Request["Password"]; ReturnURL = Request["ReturnURL"]; // 这个ReturnUrl 用来还给积分商城ticket用 AccountType = Request["AccountType"]; string RealName = ""; string UserName = ""; string NickName = ""; string CustType = ""; string CustID = ""; string ErrMsg = ""; string OutID = ""; string UserAccount = ""; string SPID = ""; //解析SPTokenRequest参数 int Resultjf = SSOClass.ParseJFLoginRequest(SPTokenRequest, this.Context, out SPID, out ProvinceID, out AuthenType, out AuthenName, out Password, out ReturnURL, out ErrMsg); if (Resultjf != 0) { //日志 log(String.Format("【解析SPTokenRequest参数失败:{0}】Result:{1},ErrMsg:{2}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Result, ErrMsg)); string err = System.Web.HttpUtility.UrlEncode("积分商城请求的token解密失败!ErrMsg=" + ErrMsg, Encoding.UTF8); Response.Redirect(JFLoginUrl + "?Result=" + Resultjf + "&ErrMsg=" + err, true); return; } //日志 log(String.Format("【解析SPTokenRequest参数成功:{0}】SPID:{1},ProvinceID:{2},AuthenType:{3},AuthenName:{4},ReturnURL:{5}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, ProvinceID, AuthenType, AuthenName, ReturnURL)); string o_ProvinceID = ""; Result = BTForBusinessSystemInterfaceRules.UserAuthV2(SPID, AuthenName, AuthenType, Password, this.Context, ProvinceID, "", "", out ErrMsg, out CustID, out UserAccount, out CustType, out OutID, out o_ProvinceID, out RealName, out UserName, out NickName); //日志 log(String.Format("【Crm认证结果:{0}】Result:{1},ErrMsg:{2},CustID:{3},UserAccount:{4},CustType:{5},OutID:{6},ProvinceID:{7}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Result, ErrMsg, CustID, UserAccount, CustType, OutID, o_ProvinceID)); if (Result != 0) { string err = System.Web.HttpUtility.UrlEncode(ErrMsg, Encoding.UTF8); string jf_loginUrl = ""; if (ReturnURL.IndexOf("?") > 0) { jf_loginUrl = ReturnURL + "&Result=" + Result + "&ErrMsg=" + err; } else { jf_loginUrl = ReturnURL + "?Result=" + Result + "&ErrMsg=" + err; } //直接将请求原路打回 --假设请求中有ReturnURL Response.Redirect(jf_loginUrl + "", true); return; } //生成token 修改 2013.01.23 string UserTokenValue = UT.GenerateJFUserToken(ProvinceID, CustID, RealName, UserName, NickName, OutID, CustType, AuthenName, AuthenType, key, out ErrMsg); //UT.GenerateUserToken(CustID, RealName, UserName, NickName, OutID, CustType, AuthenName, AuthenType, key, out ErrMsg); log("token-Result:" + Result); string CookieName0 = System.Configuration.ConfigurationManager.AppSettings["CookieName"]; //CookieName = CIPUT PageUtility.SetCookie(UserTokenValue, CookieName0, this.Page); //生成流水号 //string TransactionId = ""; //string sDate = DateTime.Now.ToString("yyyyMMddHHmmssfff"); //Random r = new Random(Guid.NewGuid().GetHashCode()); //TransactionId = "35999999" + sDate + r.Next(10000, 99999).ToString(); String TransactionId = "35999999" + CommonBizRules.CreateTransactionID(); //生成ticket //sDate = DateTime.Now.ToString("yyyyMMddHHmmssfff"); //r = new Random(); //string Ticket = sDate + r.Next(10000, 99999).ToString(); String Ticket = CommonBizRules.CreateTicket(); StringBuilder msg0 = new StringBuilder(); msg0.Append("++++++++++++++++++++++++++++++++++++++token===++++++++++++++++++++" + UserTokenValue + "++++++++++++++++++++++++++\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("REVERSE-SSO", msg0); this.sendTicket2JF(Ticket, CustID, RealName, UserAccount, OutID, UserName, AuthenName, AuthenType, NickName); #endregion } } } }