如何隐藏此对话框并保存下载文件而不提示 [英] How to hide this dialog and save downloading file without prompt
本文介绍了如何隐藏此对话框并保存下载文件而不提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一项任务是在Windows应用程序中使用Web浏览器从网站下载文件。我使用给定的代码:
I have a task for using web browser in windows application to download the file from web site. I use the given code for this :
webBrowser1.Document.GetElementById("loginform:userName").InnerText = Username;
webBrowser1.Document.GetElementById("loginform:password").InnerText = PassWord;
webBrowser1.Document.GetElementById("loginform:submit").InvokeMember("click");
webBrowser1.Document.GetElementsByTagName("select").GetElementsByName("Reports:j_idt44")[0].Document.GetElementsByTagName("option")[1].SetAttribute("selected", "selected");
webBrowser1.Document.GetElementById("Reports:j_idt72:0").SetAttribute("checked", "checked");
webBrowser1.Document.GetElementById("Reports:j_idt75").InvokeMember("click");
执行后会出现保存对话框,但我不想显示对话框,直接下载文件。任何人都会回复查询。
After the execution the save dialog box will appear, but I dont want to show the dialog box, the file directly download. Anybody response the query.
推荐答案
这些链接应该有所帮助,但这并不简单:
抑制托管的WebBrowser控件对话框 [ ^ ]
https://social.msdn.microsoft.com/Forums/vstudio/en-US / 03f65bb4-7e32-4238-a4f1-297e4ea8ccd2 / webbrowser-control-downloads?forum = csharpgeneral [ ^ ]
These links should help, but it's not simple:
Suppressing Hosted WebBrowser Control Dialogs[^]
https://social.msdn.microsoft.com/Forums/vstudio/en-US/03f65bb4-7e32-4238-a4f1-297e4ea8ccd2/webbrowser-control-downloads?forum=csharpgeneral[^]
这篇关于如何隐藏此对话框并保存下载文件而不提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文