I have the following code:
WebClient client = new WebClient();
client.OpenReadAsync(new Uri("whatever"));
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
and
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
Stream reply = (Stream)e.Result;
StreamReader s;
s = new StreamReader(reply);
this._code = s.ReadToEnd();
s.Close();
}
During debugging, I see that the compiler is not moving to the event client_OpenReadCompleted. Where is the mistake? I already tried to use DownloadStringCompletedand DownloadStringAsyncinstead, but this also does not work.
Thank you for your help.
source
share