private void container_AddUserPressed(string username, object sender) { UserInfoContainer activeContainer = sender as UserInfoContainer; RequestContainer requestContainer = new RequestContainer(username, this.accountInfo.Id, activeContainer.UserId, this.socketHelper, this.accountInfo); requestContainer.Name = "controlRequestContainer_" + username; requestContainer.Location = new Point(pnlDashboard.Right, ((activeContainer.Top + activeContainer.Height / 2) - 10)); // Add the control and set it atop on all of the existing controls this.Controls.Add(requestContainer); requestContainer.BringToFront(); }
private static List <Department> getTree() { string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=" + accss); HttpWebResponse rep = req.GetResponse(); string a = req.GetResponseContent(rep); string dy = Convert.ToString(MyUtility.GetObjFromJson <dynamic>(a).department); List <Department> department = new List <Department>(); department = MyUtility.GetObjFromJson <List <Department> >(dy); //for (int i = 0; i <= dy.department.Count; i++) { //} return(department); }
private static void createUser_tag(string tagId, string UserId) { UserTag us = new UserTag(); us.tagid = tagId; us.userlist.Add(UserId); string data = MyUtility.GetJsonFromObj(us); string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers?access_token=" + accss); req.RequestObj.Method = "POST"; req.RequestObj.ContentType = "application/Json"; req.SetRequestContent(data); HttpWebResponse rep = req.GetResponse(); string x = req.GetResponseContent(rep); }
private void configure_webrequest(string uri = null, RequestContainer rc = null) { A.CallTo(() => HttpRequestFactory.CreateRequest(null)) .WithAnyArguments() .ReturnsLazily( x => { uri = uri ?? x.GetArgument <string>(0); var request = new HttpRequestFactory().CreateRequest(uri); if (rc != null) { rc.Request = request; } return(request); }); }
private static bool Exist_Usr(string userid) { string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=" + accss + "&userid=" + userid); HttpWebResponse rep = req.GetResponse(); string a = req.GetResponseContent(rep); dynamic dy = MyUtility.GetObjFromJson <dynamic>(a); if (dy.errcode == 0) { return(true); } else { return(false); } }
public void respects_last_fetch_date_to_avoid_downloading_already_cached_content() { var rc = new RequestContainer(); configure_webrequest(_incorrectUri, rc); var lastFetchTime = new DateTime(2012, 2, 14); ignore_exceptions( () => execute(new LocalFeedInfo() { LastFetch = lastFetchTime }) ); Assert.Equal(lastFetchTime, rc.Request.IfModifiedSince); }
public void respects_etag_to_avoid_downloading_already_cached_content() { var rc = new RequestContainer(); configure_webrequest(_incorrectUri, rc); var etag = Guid.NewGuid().ToString(); ignore_exceptions( () => execute(new LocalFeedInfo() { Etag = etag }) ); Assert.Equal(etag, rc.Request.Headers[HttpRequestHeader.IfNoneMatch]); }
private void frmMessengerDialog_MouseClick(object sender, MouseEventArgs e) { foreach (Control control in this.Controls) { if (control is RequestContainer) { RequestContainer requestContainer = control as RequestContainer; if (this.Controls.Contains(requestContainer)) { this.Controls.Remove(requestContainer); requestContainer.Dispose(); requestContainer = null; this.Invalidate(); } } } }
private static string getUser(string id) { string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=" + accss + "&department_id=" + id + "&fetch_child=1"); HttpWebResponse rep = req.GetResponse(); string a = req.GetResponseContent(rep); dynamic dy = MyUtility.GetObjFromJson <dynamic>(a); List <Customer> userlist = new List <Customer>(); for (int i = 0; i < dy.userlist.Count; i++) { Customer mm = new Customer(); mm.userid = dy.userlist[i].userid; mm.status = dy.userlist[i].status; mm.name = dy.userlist[i].name; mm.mobile = dy.userlist[i].mobile; userlist.Add(mm); } return(MyUtility.GetJsonFromObj(userlist)); }
private static void MakeApiCall <TResult>(string baseUrl, Request request, Action <TResult> resultCallback, Action <MundiPaggError> errorCallback) where TResult : MundiPaggResultCommon { RequestContainer requestContainer = new RequestContainer(); requestContainer.Request = request; requestContainer.FullUrl = baseUrl + request.ApiEndPoint; requestContainer.SuccessCallback = () => { TResult result = JsonConvert.DeserializeObject <TResult>(requestContainer.JsonResponse); if (result as LoginResult != null) { MundiPaggSession.CurrentSession = JsonConvert.DeserializeObject <MundiPaggSession.Session>(requestContainer.JsonResponse); } resultCallback(result); }; requestContainer.ErrorCallback = errorCallback; instance.RequestsHistory.Add(requestContainer); instance.StartCoroutine(instance.StartRequest(requestContainer)); }
private static string GetOnlyUser(string id) { string ls = ""; string accss = MyUtility.GetGroupAccess(); RequestContainer req = new RequestContainer("https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=" + accss + "&userid=" + id); HttpWebResponse rep = req.GetResponse(); string a = req.GetResponseContent(rep); dynamic dy = MyUtility.GetObjFromJson <dynamic>(a); if (dy.errcode == 0) { ls = Convert.ToString(dy.status); } else { ls = "3"; } //List<Customer> userlist = new List<Customer>(); //Customer mm = new Customer(); //mm.status = dy.userlist[i].status; //userlist.Add(mm); return(ls); }
public void VerifyCredentials(Action<string, string> needsUserAuthorization) { CheckCredentials(delegate(bool credentialsOk) { if (credentialsOk) { needsUserAuthorization(null, null); return; } else { OAuthAccessToken = null; OAuthAccessTokenSecret = null; OAuthRequestToken = null; OAuthRequestTokenSecret = null; string baseUrl = ApiUrl.RequestTokenUrl; Dictionary<string, string> queryParams = new Dictionary<string, string>() { {RequestKeys.kOAuthCallback, Account.CallbackUrl} }; // Acquire a request token Dictionary<string, string> oAuthParams = new Dictionary<string, string>() { {RequestKeys.kOAuthConsumerKey, Account.ConsumerKey}, {RequestKeys.kOAuthNonce, Helpers.GenerateNonce()}, {RequestKeys.kOAuthSignatureMethod, ApiUrl.OAuthSignatureMethod}, {RequestKeys.kOAuthTimeStamp, Helpers.TimeStamp()}, {RequestKeys.kOAuthVersion, RequestKeys.kOAuthVersionValue} }; // Create a string of normalized paramaters string normalizedParams = Helpers.NormalizeAllParams(oAuthParams, queryParams); //Build the signature base string string signatureBase = Helpers.GetSignatureBase(Helpers.HttpMethod.Get, baseUrl, normalizedParams); string signature = Helpers.GetSignature(signatureBase, Account.ConsumerKeySecret, null); oAuthParams.Add(RequestKeys.kOAuthSignature, signature); StringBuilder authorizeHeader = AuthorizeHeaderFromKeyValues(oAuthParams); string url = CreateFullUrl(baseUrl, queryParams); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Headers["Authorization"] = authorizeHeader.ToString() + "\n"; request.Method = "GET"; request.AllowReadStreamBuffering = true; RequestContainer requestContainer = new RequestContainer(); requestContainer.Request = request; SendRequest(requestContainer, delegate(RequestContainer req) { if (req.ErrorMessage != null) { needsUserAuthorization(null, req.ErrorMessage); } else { Dictionary<string, string> kVMap = ParseResultParams(req.ResponseData); string token = kVMap.ContainsKey(RequestKeys.kOAuthToken) == false ? null : kVMap[RequestKeys.kOAuthToken]; string tokenSecret = kVMap.ContainsKey(RequestKeys.kOAuthTokenSecret) == false ? null : kVMap[RequestKeys.kOAuthTokenSecret]; if ((null == token) || (null == tokenSecret)) { throw new Exception("Invalid twitter response"); } OAuthRequestToken = token; OAuthRequestTokenSecret = tokenSecret; needsUserAuthorization(ApiUrl.AuthenticationUrl(OAuthRequestToken), null); } }); } }); }
/// <summary> /// /// </summary> /// <param name="header"></param> /// <param name="v221Provider"></param> /// <param name="requestId"></param> /// <param name="requestParams"></param> /// <param name="zsQuotedAssetSet"></param> /// <returns></returns> public V221OutputQuotedAssetSet GetMarketQuotesV221(V221Header header, V221ProviderId v221Provider, Guid requestId, string requestParams, byte[] zsQuotedAssetSet) { IModuleInfo connection = null; _connectionIndex.Locked(connections => { if (!connections.TryGetValue(header.SessionId, out connection)) { throw new ApplicationException("Ignoring request from unknown client!"); } }); //var errors = new List<V221ErrorDetail>(); var result = new QuotedAssetSet(); string step = "GetMarketQuotesV221: unknown"; try { step = "GetMarketQuotesV221: decompressing"; // deserialise inputs var receivedRequest = XmlSerializerHelper.DeserializeFromString <QuotedAssetSet>(CompressionHelper.DecompressToString(zsQuotedAssetSet)); //debug dump request //this.Logger.LogDebug("Received: {0}", XmlSerializerHelper.SerializeToString<QuotedAssetSet>(receivedRequest)); // end debug step = "GetMarketQuotesV221: splitting"; // split request into provider-specific requests // build unique instrumentSet var instrumentMap = new Dictionary <string, Asset>(); foreach (Asset asset in receivedRequest.instrumentSet.Items) { string assetId = asset.id; instrumentMap[assetId.ToLower()] = asset; } // now split quotes based on provider preferences MDSProviderId defaultProvider = V221Helpers.ToProviderId(v221Provider); int providerCount = Enum.GetValues(typeof(MDSProviderId)).Length; var providerRequests = new RequestContainer[providerCount]; for (int i = 0; i < providerRequests.Length; i++) { providerRequests[i] = new RequestContainer(); } int requestedQuoteCount = 0; foreach (BasicAssetValuation valuation in receivedRequest.assetQuote) { string assetId = valuation.objectReference.href; if (!instrumentMap.TryGetValue(assetId.ToLower(), out var asset)) { throw new ApplicationException($"Cannot find asset '{assetId}' in instrument set"); } foreach (BasicQuotation quote in valuation.quote) { if (!quote.valueSpecified) { requestedQuoteCount++; MDSProviderId quoteProvider = ChooseProvider(quote.informationSource, _activeProviders, defaultProvider); RequestContainer requestContainer = providerRequests[(int)quoteProvider]; requestContainer.InstrumentMap[assetId.ToLower()] = asset; // merge the quotes if (!requestContainer.ValuationMap.TryGetValue(assetId.ToLower(), out var bav)) { // missing - create bav = new BasicAssetValuation { objectReference = new AnyAssetReference { href = assetId } }; requestContainer.ValuationMap[assetId.ToLower()] = bav; } // append the asset quotes var quotes = new List <BasicQuotation>(); if (bav.quote != null) { quotes.AddRange(bav.quote); } quotes.Add(quote); bav.quote = quotes.ToArray(); } } } if (requestedQuoteCount == 0) { throw new ApplicationException("No quotes requested!"); } step = "GetMarketQuotesV221: calling providers"; // run each provider request foreach (MDSProviderId activeProvider in _activeProviders) { RequestContainer requestContainer = providerRequests[(int)activeProvider]; if (requestContainer.InstrumentMap.Count > 0) { // request is not empty - call the MDS provider var types = new List <ItemsChoiceType19>(); foreach (var asset in requestContainer.InstrumentMap.Values) { var assetTypeFpML = AssetTypeConvertor.ParseEnumStringToFpML(asset.id);//TODO The id must contain the asset descriptor. types.Add(assetTypeFpML); } var instrumentSet = new InstrumentSet { Items = requestContainer.InstrumentMap.Values.ToArray(), ItemsElementName = types.ToArray() }; var providerRequest = new QuotedAssetSet { instrumentSet = instrumentSet, assetQuote = requestContainer.ValuationMap.Values.ToArray() }; step = "GetMarketQuotesV221: calling " + activeProvider.ToString(); QuotedAssetSet providerResult = _providers[(int)activeProvider].GetMarketQuotes( activeProvider, connection, requestId, true, new NamedValueSet(requestParams), providerRequest).Result; // combine provider-specific results result = result.Merge(providerResult, false, true, true); } } step = "GetMarketQuotesV221: compressing"; return(new V221OutputQuotedAssetSet( CompressionHelper.CompressToBuffer(XmlSerializerHelper.SerializeToString(result)), null)); } catch (Exception excp) { Logger.LogError("Exception: step='{0}': {1}", step, excp); return(new V221OutputQuotedAssetSet(null, new V221ErrorDetail(excp))); } }
public void Logout(Action<bool> cb) { if ((OAuthAccessToken != null) && (OAuthAccessTokenSecret != null)) { string baseUrl = ApiUrl.EndSessionUrl; Dictionary<string, string> queryParams = new Dictionary<string, string>() { {RequestKeys.kOAuthCallback, Account.CallbackUrl} }; // Acquire a request token Dictionary<string, string> oAuthParams = new Dictionary<string, string>() { {RequestKeys.kOAuthConsumerKey, Account.ConsumerKey}, {RequestKeys.kOAuthNonce, Helpers.GenerateNonce()}, {RequestKeys.kOAuthSignatureMethod, ApiUrl.OAuthSignatureMethod}, {RequestKeys.kOAuthToken, OAuthAccessToken}, {RequestKeys.kOAuthTimeStamp, Helpers.TimeStamp()}, {RequestKeys.kOAuthVersion, RequestKeys.kOAuthVersionValue} }; // Create a string of normalized paramaters string normalizedParams = Helpers.NormalizeAllParams(oAuthParams, queryParams); //Build the signature base string string signatureBase = Helpers.GetSignatureBase(Helpers.HttpMethod.Post, baseUrl, normalizedParams); string signature = Helpers.GetSignature(signatureBase, Account.ConsumerKeySecret, OAuthAccessTokenSecret); oAuthParams.Add(RequestKeys.kOAuthSignature, signature); StringBuilder authorizeHeader = AuthorizeHeaderFromKeyValues(oAuthParams); StringBuilder postBody = PostDataFromKeyValues(queryParams); string url = CreateFullUrl(baseUrl, null); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); byte[] postBytes = Encoding.UTF8.GetBytes(postBody.ToString()); request.Headers["Authorization"] = authorizeHeader.ToString() + "\n"; request.ContentType = "application/x-www-form-urlencoded"; request.Method = "POST"; request.AllowReadStreamBuffering = true; RequestContainer requestContainer = new RequestContainer(); requestContainer.Request = request; requestContainer.RequestData = postBytes; SendRequest(requestContainer, delegate(RequestContainer req) { if (req.ErrorMessage != null) { cb(false); } else { // TODO: At some point we may want to parse the XML response here string s = Encoding.UTF8.GetString(req.ResponseData, 0, req.ResponseData.Length); cb(true); } }); } else { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debug.WriteLine("No Stored Twitter credentials found"); } cb(false); } }
public void CompleteAuthorization(string webBrowserRedirectUrl, Action<string> authorizationCompleted) { Dictionary<string, string> qParams = Helpers.ParseQueryString(webBrowserRedirectUrl); string oAuthToken = null; string oAuthVerifier = null; if (qParams.ContainsKey("oauth_token")) { oAuthToken = qParams["oauth_token"]; } if (qParams.ContainsKey("oauth_verifier")) { oAuthVerifier = qParams["oauth_verifier"]; } if ((oAuthToken == null) || (oAuthVerifier == null)) { string error = "Invalid browser redirect URL"; authorizationCompleted(error); throw new Exception(error); } string baseUrl = ApiUrl.AccessTokenUrl; //Dictionary<string, string> queryParams = null; //RMM may not need this Dictionary<string, string> queryParams = new Dictionary<string, string>() { {RequestKeys.kOAuthVerifier, oAuthVerifier}, }; // Acquire an access token Dictionary<string, string> oAuthParams = new Dictionary<string, string>() { {RequestKeys.kOAuthConsumerKey, Account.ConsumerKey}, {RequestKeys.kOAuthNonce, Helpers.GenerateNonce()}, {RequestKeys.kOAuthSignatureMethod, ApiUrl.OAuthSignatureMethod}, {RequestKeys.kOAuthTimeStamp, Helpers.TimeStamp()}, {RequestKeys.kOAuthVersion, RequestKeys.kOAuthVersionValue}, {RequestKeys.kOAuthToken, oAuthToken} }; // Create a string of normalized paramaters string normalizedParams = Helpers.NormalizeAllParams(oAuthParams, queryParams); //Build the signature base string string signatureBase = Helpers.GetSignatureBase(Helpers.HttpMethod.Get, baseUrl, normalizedParams); string signature = Helpers.GetSignature(signatureBase, Account.ConsumerKeySecret, OAuthRequestTokenSecret); oAuthParams.Add(RequestKeys.kOAuthSignature, signature); StringBuilder authorizeHeader = AuthorizeHeaderFromKeyValues(oAuthParams); string url = CreateFullUrl(baseUrl, queryParams); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Headers["Authorization"] = authorizeHeader.ToString() + "\n"; request.Method = "GET"; request.AllowReadStreamBuffering = true; RequestContainer requestContainer = new RequestContainer(); requestContainer.Request = request; SendRequest(requestContainer, delegate(RequestContainer req) { if (req.ErrorMessage != null) { authorizationCompleted(req.ErrorMessage); } else { Dictionary<string, string> kVMap = ParseResultParams(req.ResponseData); string token = kVMap.ContainsKey(RequestKeys.kOAuthToken) == false ? null : kVMap[RequestKeys.kOAuthToken]; string tokenSecret = kVMap.ContainsKey(RequestKeys.kOAuthTokenSecret) == false ? null : kVMap[RequestKeys.kOAuthTokenSecret]; string screenName = kVMap.ContainsKey(RequestKeys.kScreenName) == false ? null : kVMap[RequestKeys.kScreenName]; if ((null == token) || (null == tokenSecret) || (null == screenName)) { throw new Exception("Invalid twitter response"); } OAuthAccessToken = token; OAuthAccessTokenSecret = tokenSecret; ScreenName = screenName; Save(); authorizationCompleted(null); } }); }
public object GetService(Type serviceType) { return(RequestContainer.GetService(serviceType)); }
public IEnumerable <object> GetServices(Type serviceType) { return(RequestContainer.GetServices(serviceType)); }
public void Dispose() { RequestContainer.Dispose(); }
internal void SendRequest(RequestContainer requestContainer, Action<RequestContainer> requestCompleted) { // Note that current design assumes a successfull post will be followed by a getAndRead AsyncCallback getAndRead = new AsyncCallback(delegate(IAsyncResult responseResult) { RequestContainer responseContainer = (RequestContainer)responseResult.AsyncState; try { HttpWebResponse response = (HttpWebResponse)responseContainer.Request.EndGetResponse(responseResult); Stream s = response.GetResponseStream(); byte[] bytes = new byte[s.Length]; s.Read(bytes, 0, (int)s.Length); // Set the response responseContainer.ResponseData = bytes; // Release the HttpWebResponse response.Close(); } catch (WebException we) { responseContainer.ErrorMessage = new StreamReader(we.Response.GetResponseStream()).ReadToEnd(); } catch (Exception e) { responseContainer.ErrorMessage = e.ToString(); } finally { requestCompleted(requestContainer); } }); AsyncCallback postAndWrite = new AsyncCallback(delegate(IAsyncResult ar) { RequestContainer requestCBContainer = (RequestContainer)ar.AsyncState; try { HttpWebRequest request = requestCBContainer.Request; if (requestCBContainer != null) { byte[] postBytes = requestCBContainer.RequestData; Stream s = request.EndGetRequestStream(ar); s.Write(postBytes, 0, postBytes.Length); s.Close(); } // Start the asynchronous operation to get the response request.BeginGetResponse(getAndRead, requestCBContainer ); } catch (WebException we) { requestCBContainer.ErrorMessage = new StreamReader(we.Response.GetResponseStream()).ReadToEnd(); requestCompleted(requestContainer); } catch (Exception e) { requestCBContainer.ErrorMessage = e.ToString(); requestCompleted(requestContainer); } }); try { if ("POST" == requestContainer.Request.Method) { requestContainer.Request.ContentType = "application/x-www-form-urlencoded"; requestContainer.Request.BeginGetRequestStream(postAndWrite, requestContainer); } else { requestContainer.Request.BeginGetResponse(getAndRead, requestContainer); } } catch (Exception e) { requestContainer.ErrorMessage = e.ToString(); requestCompleted(requestContainer); } }
internal void CheckCredentials(Action<bool> cb) { if ((OAuthAccessToken != null) && (OAuthAccessTokenSecret != null)) { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debug.WriteLine("Stored Twitter Credentials Found"); } // Acquire a request token Dictionary<string, string> oAuthParams = new Dictionary<string, string>() { {RequestKeys.kOAuthConsumerKey, Account.ConsumerKey}, {RequestKeys.kOAuthNonce, Helpers.GenerateNonce()}, {RequestKeys.kOAuthSignatureMethod, ApiUrl.OAuthSignatureMethod}, {RequestKeys.kOAuthToken, OAuthAccessToken}, {RequestKeys.kOAuthTimeStamp, Helpers.TimeStamp()}, {RequestKeys.kOAuthVersion, RequestKeys.kOAuthVersionValue} }; // Create a string of normalized paramaters string normalizedParams = Helpers.NormalizeAllParams(oAuthParams, null); //Build the signature base string string signatureBase = Helpers.GetSignatureBase(Helpers.HttpMethod.Get, ApiUrl.VerifyCredentialsUrl, normalizedParams); string signature = Helpers.GetSignature(signatureBase, Account.ConsumerKeySecret, OAuthAccessTokenSecret); oAuthParams.Add(RequestKeys.kOAuthSignature, signature); StringBuilder authorizeHeader = AuthorizeHeaderFromKeyValues(oAuthParams); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ApiUrl.VerifyCredentialsUrl); request.Headers["Authorization"] = authorizeHeader.ToString() + "\n"; request.Method = "GET"; request.AllowReadStreamBuffering = true; RequestContainer requestContainer = new RequestContainer(); requestContainer.Request = request; SendRequest(requestContainer, delegate(RequestContainer req) { if (req.ErrorMessage != null) { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debug.WriteLine("Stored Twitter Credentials are invalid"); } cb(false); } else { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debug.WriteLine("Stored Twitter Credentials are valid"); } cb(true); } }); } else { if (System.Diagnostics.Debugger.IsAttached) { System.Diagnostics.Debug.WriteLine("No Stored Twitter credentials found"); } cb(false); } }
protected override void Awake() { base.Awake(); _requestContainer = GetComponent <RequestContainer>(); }
public void UpdateStatus(string status, Action<string> completed) { if ((OAuthAccessToken == null) || (OAuthAccessTokenSecret == null)) { completed("Not Authorized to update this Twitter Account"); } else { string baseUrl = ApiUrl.StatusUpdateUrl; Dictionary<string, string> queryParams = new Dictionary<string, string>() { {RequestKeys.kStatus, status} }; // Acquire a request token Dictionary<string, string> oAuthParams = new Dictionary<string, string>() { {RequestKeys.kOAuthConsumerKey, Account.ConsumerKey}, {RequestKeys.kOAuthNonce, Helpers.GenerateNonce()}, {RequestKeys.kOAuthSignatureMethod, ApiUrl.OAuthSignatureMethod}, {RequestKeys.kOAuthToken, OAuthAccessToken}, {RequestKeys.kOAuthTimeStamp, Helpers.TimeStamp()}, {RequestKeys.kOAuthVersion, RequestKeys.kOAuthVersionValue} }; // Create a string of normalized paramaters string normalizedParams = Helpers.NormalizeAllParams(oAuthParams, queryParams); //Build the signature base string string signatureBase = Helpers.GetSignatureBase(Helpers.HttpMethod.Post, baseUrl, normalizedParams); string signature = Helpers.GetSignature(signatureBase, Account.ConsumerKeySecret, OAuthAccessTokenSecret); oAuthParams.Add(RequestKeys.kOAuthSignature, signature); StringBuilder authorizeHeader = AuthorizeHeaderFromKeyValues(oAuthParams); StringBuilder postBody = PostDataFromKeyValues(queryParams); string url = CreateFullUrl(baseUrl, null); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); byte[] postBytes = Encoding.UTF8.GetBytes(postBody.ToString()); request.Headers["Authorization"] = authorizeHeader.ToString() + "\n"; request.ContentType = "application/x-www-form-urlencoded"; request.Method = "POST"; request.AllowReadStreamBuffering = true; RequestContainer requestContainer = new RequestContainer(); requestContainer.Request = request; requestContainer.RequestData = postBytes; SendRequest(requestContainer, delegate(RequestContainer req) { if (req.ErrorMessage != null) { completed( req.ErrorMessage); } else { // TODO: At some point we may want to parse the XML response here string s = Encoding.UTF8.GetString(req.ResponseData,0, req.ResponseData.Length); completed(null); } }); } }