Download a file from a link on a WPF Browser Application application
How do I download a file from a link on a WPF Browser Application application, I am using the method NavigationService.Navigate(http://www.google.com/docs/Arquivo.xlsx ") Works for download window opens but after that download was completed or canceled I can not 开发者_如何学Gobut enter navigate the pages using method NavigationService.Navigate, I noticed that the Content property of NavigationService is null when I navigate to a file path, someone know what's going on?
I don't actually understand what are your goals.
If you need to download file it's better to use WebRequest rather than NavigationService:
var request = WebRequest.Create("http://www.farmanager.com/files/Far20b1777.x86.20110108.msi");
using (var stream = request.GetResponse().GetResponseStream())
{
using (var reader = new StreamReader(stream))
{
var fileContent = reader.ReadToEnd();
}
}
精彩评论