Hi all,
Any help is greatly appreciated!
I am trying to convert HTML pages into mht. I used code from
http://www.eggheadcafe.com/articles/20040527.asp.
I would like to create a small utility (console application) for
performing the task. While asp page works fine, executing same code in
console application project gives following error:
"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
MHTConverter.exe
Additional information: Interface not registered"
What is wrong? Code of console application is given below.
Thanks in advance,
DS
===============================
using System;
using System.Web;
using CDO;
using ADODB;
using System.Text;
<reference to ADODB>
<reference to CDO>
namespace MHTConverter
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Console.WriteLine ("Starting...");
//MIMEConverter mconv = new MIMEConverter();
SaveWebPageToMHTFile( "http://www.yahoo.com",
"D:\\Test\\First.mht");
}
public static void SaveWebPageToMHTFile( string url, string
filePath)
{
CDO.Message msg = new CDO.MessageClass();
ADODB.Stream stm=null ;
msg.MimeFormatted =true;
msg.CreateMHTMLBody(url,CDO.CdoMHTMLFlags.cdoSuppr essNone, "" ,"" );
stm = msg.GetStream();
stm.SaveToFile(filePath,ADODB.SaveOptionsEnum.adSa veCreateOverWrite);
msg=null;
stm.Close();
return;
}
}