You can pass the delegate (as part of the async status parameter) that you want to call. Then after your EndGetResponseStream does what you need, then call this delegate with any parameters you need.
Personally, as you move on to the aysnc programming model (I assume to improve performance), I highly recommend that you move your workflow to asynchronous. This model allows you to process the results as they become available and as quickly as possible without any locks.
Edit
There is an article on my blog
HttpWebRequest - Asynchronous Programming Model /Task.Factory.FromAsyc
. , , , , . GetAsync PostAsync , .
public static void GetAsyncTask(string url, Action<HttpWebRequestCallbackState> responseCallback,
string contentType = "application/x-www-form-urlencoded")
responseCallback? , .
, ( PostAsyn()
var iterations = 100;
for (int i = 0; i < iterations; i++)
{
var postParameters = new NameValueCollection();
postParameters.Add("data", i.ToString());
HttpSocket.PostAsync(url, postParameters, callbackState =>
{
if (callbackState.Exception != null)
throw callbackState.Exception;
Console.WriteLine(HttpSocket.GetResponseText(callbackState.ResponseStream));
});
}
URL-. GET - (POST), - , , . , , , " ".
Action<HttpWebRequestCallbackState>
HttpWebRequestCallbackState - , , , . Action.