public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state) { var result = new HttpRequestAsyncResult(callback, state); Dictionary <string, string> headers = new Dictionary <string, string>(); foreach (var key in this.Headers.AllKeys) { headers.Add(key, this.Headers.Get(key)); } this._webRequestHelper.MakeRequest(this.RequestUri, this.Method, this, headers, null, (o, e) => callback(result), true, CredentialsMode.Disabled); return(result); }
public override WebResponse EndGetResponse(IAsyncResult asyncResult) { HttpRequestAsyncResult castedAsyncResult = asyncResult as HttpRequestAsyncResult; if (castedAsyncResult == null) { throw new ArgumentException("asyncResult"); } //string xmlReturnedFromTheServer = castedAsyncResult.XmlReturnedFromTheServer; HttpWebResponse response = new HttpWebResponse(this._webRequestHelper.GetXmlHttpRequest()); return(response); }