Пример #1
0
        private static void BeginRequest(IAsyncResult ar)
        {
            HttpHelper helper = ar.AsyncState as HttpHelper;

            if (helper != null)
            {
                Stream stream = helper.Request.EndGetRequestStream(ar);
                if (stream != null)
                {
                    // Raise the begin request event to allow writing to the stream before the post data.
                    HttpStreamEventArgs e = new HttpStreamEventArgs(helper, stream);
                    helper.OnRequestBegin(e);

                    // Write the PostData to the stream.
                    byte[] buffer = helper.PostData.ToArray();
                    if (buffer != null && buffer.Length > 0)
                    {
                        stream.Write(buffer, 0, buffer.Length);
                    }
                    stream.Close();
                }
                helper.Request.BeginGetResponse(new AsyncCallback(HttpHelper.BeginResponse), helper);
            }
        }
Пример #2
0
 private void OnRequestBegin(HttpStreamEventArgs e)
 {
     this.RequestBegin(e);
 }
Пример #3
0
 private void OnResponseComplete(HttpStreamEventArgs e)
 {
     this.ResponseComplete(e);
 }