예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CookieHelper.WriteCookie("WXLoginType", "3");

                #region 获取返回路径
                string returnurl = GlobalUtils.WebURL + "/Member/my_account.aspx";

                if (!string.IsNullOrEmpty(WEBRequest.GetString("ReturnUrl")))
                {
                    returnurl = WEBRequest.GetString("ReturnUrl");//团贷网返回路径
                    if (string.IsNullOrEmpty(returnurl))
                    {
                        returnurl = GlobalUtils.WebURL + "/Member/my_account.aspx";
                    }
                }
                #endregion

                string        CallbackUrl = GlobalUtils.WebURL + ConfigHelper.getConfigString("CallbackUrl") + "?ReturnUrl=" + returnurl;
                ThirdLoginSDK shareSdk    = new ThirdLoginSDK();
                shareSdk.InitSDK(ThirdLoginSDK.ThirdLoginType.WeiXin);
                //获取微信授权时URL
                string requestUrl = shareSdk.GetCodeUrl(CallbackUrl);

                Response.Redirect(requestUrl);
            }
        }
예제 #2
0
        private void GetRequestToken()
        {
            CookieHelper.WriteCookie("WXLoginType", "1");

            #region 获取返回路径
            string returnurl = GlobalUtils.WebURL + "/Member/my_account.aspx";

            if (!string.IsNullOrEmpty(WEBRequest.GetString("ReturnUrl")))
            {
                returnurl = WEBRequest.GetString("ReturnUrl");
                if (string.IsNullOrEmpty(returnurl))
                {
                    returnurl = GlobalUtils.WebURL + "/Member/my_account.aspx";
                }
            }
            #endregion

            string        CallbackUrl = "ReturnUrl=" + returnurl;
            ThirdLoginSDK shareSdk    = new ThirdLoginSDK();
            shareSdk.InitSDK(ThirdLoginSDK.ThirdLoginType.QQ);
            //获取微信授权时URL
            string requestUrl = shareSdk.GetCodeUrl(CallbackUrl);

            Response.Redirect(requestUrl);
        }