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 .InteropService s.COMException' occurred in
MHTConverter.ex e
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.WriteLi ne ("Starting...") ;
//MIMEConverter mconv = new MIMEConverter() ;
SaveWebPageToMH TFile( "http://www.yahoo.com",
"D:\\Test\\Firs t.mht");
}
public static void SaveWebPageToMH TFile( string url, string
filePath)
{
CDO.Message msg = new CDO.MessageClas s();
ADODB.Stream stm=null ;
msg.MimeFormatt ed =true;
msg.CreateMHTML Body(url,CDO.Cd oMHTMLFlags.cdo SuppressNone, "" ,"" );
stm = msg.GetStream() ;
stm.SaveToFile( filePath,ADODB. SaveOptionsEnum .adSaveCreateOv erWrite);
msg=null;
stm.Close();
return;
}
}
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 .InteropService s.COMException' occurred in
MHTConverter.ex e
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.WriteLi ne ("Starting...") ;
//MIMEConverter mconv = new MIMEConverter() ;
SaveWebPageToMH TFile( "http://www.yahoo.com",
"D:\\Test\\Firs t.mht");
}
public static void SaveWebPageToMH TFile( string url, string
filePath)
{
CDO.Message msg = new CDO.MessageClas s();
ADODB.Stream stm=null ;
msg.MimeFormatt ed =true;
msg.CreateMHTML Body(url,CDO.Cd oMHTMLFlags.cdo SuppressNone, "" ,"" );
stm = msg.GetStream() ;
stm.SaveToFile( filePath,ADODB. SaveOptionsEnum .adSaveCreateOv erWrite);
msg=null;
stm.Close();
return;
}
}