C#下载网页为mht文件

首先添加com引用CDO for windows 2000 library,然后下面的函数就可以完成下载的功能:

代码
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->        static void downloadMht(string url, string path)
        {
            CDO.Message msg 
= new CDO.Message();
            CDO.Configuration cfg 
= new CDO.Configuration();

            msg.Configuration 
= cfg;
            msg.CreateMHTMLBody(url, CDO.CdoMHTMLFlags.cdoSuppressAll, 
"""");
            msg.GetStream().SaveToFile(path, ADODB.SaveOptionsEnum.adSaveCreateOverWrite);
        }

 

 

posted on 2010-04-07 16:24  小橋流水  阅读(272)  评论(0编辑  收藏  举报

导航