使用C#保存网页 [英] Saving a webpage with C#

查看:138
本文介绍了使用C#保存网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试使用C#保存网址内容,或者更好地解释一下,尝试实现任何导航器的另存为功能,将网页保存在html文件中,以及包含的文件夹所有文件和图像,或保存到mht,有没有办法使用.net框架,或允许我的任何库或组件?,谢谢...

解决方案

首先是一些谷歌搜索?

看,第一页上有什么:使用本机.NET代码将任何URL转换为MHTML存档 [ ^ ]


< blockquote> CodeProject是你的朋友:使用本机.NET代码将任何URL转换为MHTML存档[ ^ ]。这是一篇旧文章(2005年),基于Google的MHTBuilder,但它是由Jeff Atwood,他本人,StackOverFlow的联合创始人。





最近,有一个HTMLAgilityPack,很多人发现它可以用于从网页中获取任何内容; 2014年9月更新的C#库位于NuGet上:[ ^ ]。



有一篇关于在ASP.NET中使用HTMLAgilityPack的CodeProject文章:[ ^ ]。


Hello to everyone, I'm trying to save the content of an url using C#, or better explained, trying to implement the functionality "Save As" of any navigator, save the webpage in a html file, and a folder containing all the files and images, or save it to mht, is there any way to make this using .net framework, or any library or component that allow me?, thanks...

解决方案

What about some googling first?
Look, what's on the first page: Convert any URL to a MHTML archive using native .NET code[^]


CodeProject is your friend: "Convert any URL to a MHTML archive using native .NET code" [^]. This is an old article (2005), based on Google's MHTBuilder, but it's by Jeff Atwood, himself, co-founder of StackOverFlow.


More recently, there is the HTMLAgilityPack which many people found useful for getting whatever out of web-page; a C# library, updated Sept. 2014, is on NuGet: [^].

There's a CodeProject article on using HTMLAgilityPack with ASP.NET: [^].


这篇关于使用C#保存网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆