How can I use HttpWebRequest (.NET, C#) asynchronously?
Use HttpWebRequest.BeginGetResponse()
HttpWebRequest.BeginGetResponse()
HttpWebRequest webRequest; void StartWebRequest() { webRequest.BeginGetResponse(new AsyncCallback(FinishWebRequest), null); } void FinishWebRequest(IAsyncResult result) { webRequest.EndGetResponse(result); }
The callback function is called when the asynchronous operation is complete. You need to at least call EndGetResponse() from this function.
EndGetResponse()
1.4m articles
1.4m replys
5 comments
57.0k users