WebRequest.Create is a wait until process complete code required?
When using the WebRequest.Create do I have to set a wait/response code before processing the next link. Meaning will WebRequest function auto wait until its complete bef开发者_如何学运维ore processing the next step or another link?
try
{
req = WebRequest.Create(strURL + listId.SelectedItem as string + "&admire=1");
req.Proxy = proxyObject;
req.Method = "POST";
req.Timeout = 5000;
}
catch (Exception eq)
{
string sErr = "Cannot connect to " + listId.SelectedItem + " : " + eq.Message;
MessageBox.Show(sErr, strURL, MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
The GetResponse()
method is a synchronous method that will only return after the server sends a reply.
The BeginGetResponse()
method is an asynchronous method that will return immediately, before the server replies.
精彩评论