[Windows 8.1 - Webview]如何使用C#下载完整的网页? [英] [Windows 8.1 - Webview]How do I donwload a complete webpage with C#?
问题描述
大家好,
我需要使用Webview下载整个网页。我检查了CapturePreviewToStreamAsync()方法,但它只捕获我正在看到的网页部分的预览(没有向下滚动)。
我是什么我正在寻找的是下载整个网页(完整的CSS,图像等)。我有很多想法怎么做,但我错过了最重要的部分:如何下载网页背后的代码?
非常感谢!!
Jymmy097
编辑:
我找到了我要找的东西:HttpClient类。
现在,让我们假设我正在下载网页及相关文件和用户暂停应用程序...那时会发生什么?
谢谢!
基本上,这是 Web抓取的问题: http://en.wikipedia.org/wiki/Web_scraping [ ^ ]。
一种最灵活的方法是使用类HttpWebRequest
。请查看我过去的答案:
获取具体信息来自网页的数据 [ ^ ],
如何从其他网站获取数据 [ ^ ]。
-SA
Hi everybody,
I need to donwload an entire webpage using a Webview. I checked out the CapturePreviewToStreamAsync() method, but it catch only a preview of the part of the webpage I'm currently seeing (without scrolling down).
What I'm looking for is to download the entire webpage (complete of css, images and so on). I ahve a lot of ideas how to do it, but I'm missing the most important part: how to download the code behind for a webpage?
Thanks a lot!!
Jymmy097
EDIT:
I found what I was looking for: the HttpClient class.
Now, let's suppose I'm downloading the webpage and the related files and the user suspend the application... what will happen at that time??
Thanks!
Basically, this is a problem of Web scraping: http://en.wikipedia.org/wiki/Web_scraping[^].
One way, the most flexible one, is using the classHttpWebRequest
. Please see my past answers:
get specific data from web page[^],
How to get the data from another site[^].
—SA
这篇关于[Windows 8.1 - Webview]如何使用C#下载完整的网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!