简体   繁体   English

通过重定向链接使用webrequest.create c#下载文件

[英]Download a File using webrequest.create c# via redirected link

I am trying to download a file from a page that redirects itself using JS. 我正在尝试从使用JS重定向自身的页面下载文件。 For example: https://wix.codeplex.com/downloads/get/119160 When that page is loaded in the browser the file download starts automatically using a JS function. 例如: https : //wix.codeplex.com/downloads/get/119160在浏览器中加载该页面时,将使用JS函数自动开始文件下载。 But when I try to download it using webrequest.create I only get the HTML of that page (119160). 但是,当我尝试使用webrequest.create下载它时,我仅获得该页面的HTML(119160)。

Is there any clean way to download the file without inspecting the html/js manually? 是否有任何干净的方法下载文件而无需手动检查html / js?

Thanks, 谢谢,

Could use WebBrowser control (which can handle JS execution) then subscribe to the FileDownload event. 可以使用WebBrowser控件(可以处理JS执行),然后订阅FileDownload事件。

For a little earlier notice, you could subscribe to Navigating (which should get triggered once the JS kicks in). 提前通知,您可以订阅导航 (在JS启动后应触发)。

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

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