简体   繁体   English

C#中的Webbrowser控件保存对话框问题

[英]Webbrowser Control in c# save dialog issue

I am using a web browser control to download a file while clicking button in a web page,and save in my own folder. 我正在使用Web浏览器控件在单击网页中的按钮的同时下载文件,并将其保存在我自己的文件夹中。

The issue is that when I tried to download a save dialog pop up is coming. 问题是,当我尝试下载保存对话框时,将弹出一个对话框。 I have tried several code but not sucesss. 我尝试了几种代码,但没有成功。 I have given my code below. 我在下面给出了我的代码。

HtmlElement Loginbutton = webBrowser1.Document.GetElementById("btnLogin");
           if (Loginbutton != null)
           {
               Loginbutton.InvokeMember("click");

           }
 HtmlElement okbutton = webBrowser1.Document.GetElementById("linkPDFResult");
            if (okbutton != null)
            {
                okbutton.InvokeMember("click");
            }

I want to download the PDF report to my folder without showing the save dialog control. 我想将PDF报告下载到我的文件夹中而不显示保存对话框控件。

只需从HtmlElement获取链接,然后使用System.Net.WebClient.DownloadFile(...)下载文件即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM