private void button7_Click(object sender, RoutedEventArgs e)
{
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(new Uri("http://asd.com/bb"));
}
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
MessageBox.Show(e.Result);
}
else {
MessageBox.Show("err: " + e.Error.ToString());
}
}
how can i get the url from DownloadStringCompleted? Or how Can i pass some parameter to my DownloadStringCompleted?
Help please
You can pass any object through the second parameter of DownloadStringAsync. Then you can retrieve that object through DownloadStringCompletedEventArgs.UserState.