//ͬ��http���� public string SyncRequest( Oauthkey2 oauthkey2, string url, string httpMethod, List<Parameter> listParam, List<Parameter> listFile) { Oauth oauth = new Oauth(oauthkey2); string queryString = null; string oauthUrl = oauth.GetOauthUrl( url, oauthkey2.appKey, oauthkey2.appSecret, oauthkey2.tokenKey, oauthkey2.callbackUrl, listParam, out queryString); SyncHttp http = new SyncHttp(); if (httpMethod == "GET") { return http.HttpGet(oauthUrl, queryString); } else if ((listFile == null) || (listFile.Count == 0)) { return http.HttpPost(oauthUrl, queryString); } else { return http.HttpPostWithFile(oauthUrl, queryString, listFile); } }
//同步http请求 public string SyncRequest( Oauthkey2 oauthkey2, string url, string httpMethod, List <Parameter> listParam, List <Parameter> listFile) { Oauth oauth = new Oauth(oauthkey2); string queryString = null; string oauthUrl = oauth.GetOauthUrl( url, oauthkey2.appKey, oauthkey2.appSecret, oauthkey2.tokenKey, oauthkey2.callbackUrl, listParam, out queryString); SyncHttp http = new SyncHttp(); if (httpMethod == "GET") { return(http.HttpGet(oauthUrl, queryString)); } else if ((listFile == null) || (listFile.Count == 0)) { return(http.HttpPost(oauthUrl, queryString)); } else { return(http.HttpPostWithFile(oauthUrl, queryString, listFile)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsCallback) { Oauthkey2 oauthKey = new Oauthkey2( StringParserHelper.GetConfig("AppKey"), StringParserHelper.GetConfig("AppSercet")); oauthKey.ParseToken(this.Request.Url.ToString()); oauthKey.callbackUrl = StringParserHelper.GetConfig("CallbackUrl"); var oauth2 = new Oauth(oauthKey); var accessToken = oauth2.GetAccessToken(); if (string.IsNullOrWhiteSpace(accessToken)) { this.Response.Write("获取Access_Token失败"); } this.Session["accessToken"] = accessToken; txtMsg.Text = "授权成功,accessToken:" + accessToken; var user = new user(oauthKey, "UTF-8").info(); txtUserInfo.Text = "账户信息:\r\n" + user; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsCallback) { var appKey = StringParserHelper.GetConfig("AppKey"); if (string.IsNullOrWhiteSpace(appKey)) { this.Response.Write("<script>alert('AppKey为空,请确认Web.Config中是否已经配置相关信息。')</script>"); return; } var appSecret = StringParserHelper.GetConfig("AppSercet"); if (string.IsNullOrWhiteSpace(appSecret)) { this.Response.Write("<script>alert('AppSecret为空,请确认Web.Config中是否已经配置相关信息。')</script>"); return; } var callbackUrl = StringParserHelper.GetConfig("CallbackUrl"); if (string.IsNullOrWhiteSpace(callbackUrl)) { this.Response.Write("<script>alert('CallbackUrl为空,请确认Web.Config中是否已经配置相关信息。')</script>"); return; } var oauthKey = new Oauthkey2(appKey, appSecret); oauthKey.callbackUrl = callbackUrl; authLink.NavigateUrl = oauthKey.urlUserAuthrize(oauthKey.callbackUrl); } }
public QQWeiboService(string appKey,string appSecret,string tokenKey,string openId) { oauthKey = new Oauthkey2(appKey, appSecret); oauthKey.tokenKey = tokenKey; oauthKey.openId = openId; //oauthKey.tokenSecret = accessSecret; accessor = new PlatFormInfoAccessor(); }
//异步http请求 public bool AsyncRequest( string url, string httpMethod, Oauthkey2 key, List <Parameter> listParam, List <Parameter> listFile, AsyncRequestCallback callback, out int callbkey) { Oauth oauth = null; oauth = new Oauth(key); string queryString = null; string oauthUrl = oauth.GetOauthUrl( url, key.appKey, key.appSecret, key.tokenKey, key.callbackUrl, listParam, out queryString); AsyncHttp http = new AsyncHttp(); callbkey = GetKey(); CallbackInfo callbackInfo = new CallbackInfo(); callbackInfo.key = callbkey; callbackInfo.callback = callback; asyncRquestMap.Add(http, callbackInfo); bool bResult = false; if (httpMethod == "GET") { bResult = http.HttpGet(oauthUrl, queryString, new AsyncHttpCallback(HttpCallback)); } else if ((listFile == null) || (listFile.Count == 0)) { bResult = http.HttpPost(oauthUrl, queryString, new AsyncHttpCallback(HttpCallback)); } else { bResult = http.HttpPostWithFile(oauthUrl, queryString, listFile, new AsyncHttpCallback(HttpCallback)); } if (!bResult) { asyncRquestMap.Remove(http); } return(bResult); }
//�첽http���� public bool AsyncRequest( string url, string httpMethod, Oauthkey2 key, List<Parameter> listParam, List<Parameter> listFile, AsyncRequestCallback callback, out int callbkey) { Oauth oauth = null; oauth = new Oauth(key); string queryString = null; string oauthUrl = oauth.GetOauthUrl( url, key.appKey, key.appSecret, key.tokenKey, key.callbackUrl, listParam, out queryString); AsyncHttp http = new AsyncHttp(); callbkey = GetKey(); CallbackInfo callbackInfo = new CallbackInfo(); callbackInfo.key = callbkey; callbackInfo.callback = callback; asyncRquestMap.Add(http, callbackInfo); bool bResult = false; if (httpMethod == "GET") { bResult = http.HttpGet(oauthUrl, queryString, new AsyncHttpCallback(HttpCallback)); } else if ((listFile == null) || (listFile.Count == 0)) { bResult = http.HttpPost(oauthUrl, queryString, new AsyncHttpCallback(HttpCallback)); } else { bResult = http.HttpPostWithFile(oauthUrl, queryString, listFile, new AsyncHttpCallback(HttpCallback)); } if (!bResult) { asyncRquestMap.Remove(http); } return bResult; }
/// <summary> /// 构造函数 <see cref="user"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public user(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary>数据更新相关 /// 构造函数 <see cref="info"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public info(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary>话题类 构造函数 /// <see cref="ht"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public ht(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary> 搜索相关 需要 合作伙伴权限 /// 构造函数 <see cref="search"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public search(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary> /// 构造函数<see cref="trends"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public trends(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary>构造函数 /// <see cref="friends"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public friends(Oauthkey2 okey, string format) : base(okey, format) { }
public QWeiboApiBase(Oauthkey2 authkey, string format) { this.Oauthkey2 = authkey; this.format = format; }
/// <summary> /// 构造函数 <see cref="tag"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public tag(Oauthkey2 okey, string format) : base(okey, format) { }
public Oauth(Oauthkey2 oauthkey2) { this.Oauthkey2 = oauthkey2; }
/// <summary> 时间线相关 /// 构造函数<see cref="statuses"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public statuses(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary> 私信相关 /// 构造函数 <see cref="@private"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public @private(Oauthkey2 okey, string format) : base(okey, format) { }
/// <summary> 其他api 接口 /// Initializes a new instance of the <see cref="other"/> class. /// </summary> /// <param name="okey">The okey.</param> /// <param name="format">The format.</param> /// <remarks></remarks> public other(Oauthkey2 okey, string format) : base(okey, format) { }