开发者

Download a file from a link on a WPF Browser Application application

开发者 https://www.devze.com 2023-02-06 04:24 出处:网络
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

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();
            }
        }
0

精彩评论

暂无评论...
验证码 换一张
取 消