WebClient DownloadStringCompleted只触发一次

本文关键字:一次 DownloadStringCompleted WebClient | 更新日期: 2023-09-27 18:18:18

我得到了这个代码:

private void LoadXML()
{
    WebClient myWebClient = new WebClient();
    myWebClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(myWebClient_DownloadStringCompleted);
    myWebClient.DownloadStringAsync(new Uri(strXMLPath));
}
private void myWebClient_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    //Do stuff                       
}

myWebClient_DownloadStringCompleted只在我第一次调用LoadXML()时被触发。我试图获得的xml文件上没有错误,所以我应该期待一个结果。我错过了什么?

WebClient DownloadStringCompleted只触发一次

我设法缩小了问题的范围。我有一个asp:updatepanel内的silverlight对象,当我移动到更新面板外的silverlight对象,事情开始工作。