简体   繁体   English

C# wpf webbrowser控件-下载文件

[英]C# wpf webbrowser control - download file

I'm using the webbrowser control to scrape my medical information from my Health Care provider, The website is secured using a username and password, I've managed to scrape everything I need except some pdf file.我正在使用 webbrowser 控件从我的医疗保健提供者那里抓取我的医疗信息,该网站使用用户名和密码进行保护,除了一些 pdf 文件之外,我设法抓取了我需要的所有内容。

After navigating to the page I get this javascript "Loading...", In a regular browser I'll see the PDF file rendered in the browser, but for the webbrowser control it doesn't display the pdf, I get the famous yellow notification bar.导航到页面后,我得到这个 javascript“正在加载...”,在常规浏览器中,我会看到浏览器中呈现的 PDF 文件,但对于 webbrowser 控件,它不显示 pdf,我得到了著名的黄色通知栏。

The url for the pdf file is like this pdf文件的网址是这样的

"https://www.***.com/phoenix/views/akgCharts/zoomAkgChart.jsp?&date=20130502&time=123000", 

I'm using mshtml to do all the scraping, I don'tfind the file in the mshtml object, using fidller 2.0 I can see that the pdf file is downloaded to the computer (somewhere in the memory, I didn't find it in any folder)我正在使用 mshtml 进行所有抓取,我在 mshtml 对象中找不到该文件,使用 fidller 2.0 我可以看到 pdf 文件已下载到计算机(在内存中的某处,我没有在任何文件夹)

Any idea??任何的想法??

if you know the url what is sends you the file you can try something like this:如果您知道向您发送文件的网址,您可以尝试以下操作:

System.Net.WebClient _wclient = new System.Net.WebClient();
_wclient.DownloadFile("https://www.***.com/phoenix/views/akgCharts/zoomAkgChart.jsp?&date=20130502&time=123000",", @"c:\MedicalReport_" + DateTime.Now + ".pdf");

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

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