FHSSpiritDataControl.DataControlNews.GetRequestStreamCallback C# (CSharp) Method

GetRequestStreamCallback() private method

private GetRequestStreamCallback ( IAsyncResult asynchronousResult ) : void
asynchronousResult IAsyncResult
return void
        private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
        {
            HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

            // End the operation
            Stream postStream = request.EndGetRequestStream(asynchronousResult);

            //sample
            string postData = "{\"newsComment\":{\"content\":\"" + this.m_strNewComment + "\",\"news\":{\"news_id\":" + this.m_nNewMessageID.ToString() + "},\"owner\":{\"fhs_id\":\"" + this.m_strFHSID + "\"}}}";
            // Convert the string into a byte array.
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);

            //Latin 1
            //byte[] byteArray = System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(postData);

            // Write to the request stream.
            postStream.Write(byteArray, 0, byteArray.Length);
            postStream.Close();

            // Start the asynchronous operation to get the response
            request.BeginGetResponse(new AsyncCallback(GetResponseCallback), request);
        }