-1
我在Silverlight中使用了浏览器应用程序。如何在OOB应用程序中使用Web客户端方法获取xml文件
我在加载xml文件usine下面提到的代码时遇到问题。
string contentUri = Application.Current.Host.Source
.AbsoluteUri;
var contentUri1 = contentUri.Substring(0, contentUri.LastIndexOf("/")) + "/Hello1.xml";
WebClient wc = new WebClient();
wc.OpenReadCompleted+=(open,read)=>
{
string content;
using (StreamReader reader = new StreamReader(read.Result,Encoding.Unicode))
{
byte[] m_Bytes = ReadToEnd(read.Result);
string s = Encoding.UTF8.GetString(m_Bytes, 0, m_Bytes.Length);
}
};
wc.DownloadProgressChanged
+= (chang,dh)=>
{
};
wc.OpenReadAsync(new Uri(contentUri));
在我的xml文件包含
<Root>
<element>FirstElement</element>
</Root>
我得到的垃圾值作为输出谁能请帮助我,我怎么可以下载原始的XML内容?