C#WPF - 没有对话框的webbrowser控件下载 [英] C# WPF - webbrowser control download without dialog box

查看:87
本文介绍了C#WPF - 没有对话框的webbrowser控件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WPF项目中,我使用方法



In a WPF project I use the method

webBrowser.Navigate(strUrl);

<从服务器获取PNG图片。


出现以下对话框:



文件下载/你想打开还是保存这个文件?



如何通过静默下载图片来摆脱这个对话框?



我尝试了什么:



我试图在

中使用一些注册表设置HKEY_CURRENT_USER \Software \ Microoft\Internet Explorer \ Main.\\FeatureControl

如FEATURE_DOWNLOAD_PROMPT_META_CONTROL等等......



to get a PNG picture from the server. Following dialog appears:

"File download" / "Do you want to open or save this file?"

How to get rid of this dialog by dowloading the picture silently?

What I have tried:

I've tried to use some Registry settings in
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl
such as "FEATURE_DOWNLOAD_PROMPT_META_CONTROL" and so long ...

推荐答案

为什么不使用System.Net.WebClient?



例如

Why not using the System.Net.WebClient?

e.g.
var webClient = new WebClient();
webClient.DownloadFile(new Uri("http://www.google.de//images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"), @"c:\temp\google.png");



将下载Google徽标并将其作为google.png保存在您的硬盘上而不会有任何问题。


will download the Google logo and save it as google.png on your hard drive without asking any questions.


这篇关于C#WPF - 没有对话框的webbrowser控件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆