protected void ibtnLogin_Click(object sender, ImageClickEventArgs e) { if (string.IsNullOrEmpty(HttpContext.Current.User.Identity.Name)) { BLL.WebConfigExt bllWebConfig = new BLL.WebConfigExt(); string appID = bllWebConfig.GetQQAppID(); string appKey = bllWebConfig.GetQQAppKey(); string domain = bllWebConfig.GetDomainWithHttp(); string callBackUrl = domain + _callBackPage; string onSuccessRedirectUrl = domain + _onSuccessRedirectPage; string onFailRedirectUrl = domain + _onFailRedirectPage; Qzone.OAuth.Utility.Login(appID, appKey, callBackUrl, onSuccessRedirectUrl, onFailRedirectUrl); } else { lv_Common.MessageBox.Show(Page, "你已登录本站,请先注销用户再登录"); } }
protected void ibtnLogin_Click(object sender, ImageClickEventArgs e) { string curUser = HttpContext.Current.User.Identity.Name; if (string.IsNullOrEmpty(curUser)) { var httpRequest = HttpRequestFactory.CreateHttpRequest(Method.GET) as HttpGet; httpRequest.GetRequestToken(); string url = httpRequest.GetAuthorizationUrl(); Session["oauth_token"] = httpRequest.Token; Session["oauth_token_secret"] = httpRequest.TokenSecret; BLL.WebConfigExt bllWebConfig = new BLL.WebConfigExt(); string domain = bllWebConfig.GetDomainWithHttp(); Session["SinaReturnUrl"] = Request.RawUrl; _returnUrl = "/SinaLoginSuccess.aspx"; string callBackUrl = domain + _returnUrl; Response.Redirect(url + "&oauth_callback=" + callBackUrl + ""); } else { lv_Common.MessageBox.Show(Page, "你已登录本站,请先注销用户再登录"); } }