473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Error converting html page into mht

DS
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;
}
}
Jul 21 '05 #1
0 1084

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Al Moritz | last post by:
Hi all, I was always told that the conversion of Word files to HTML as done by Word itself sucks - you get a lot of unnecessary code that can influence the design on web browsers other than...
1
by: Laurie Dvorak | last post by:
I'm working on converting a website that currently is all static HTML pages to ASP.NET. Since people may have some of the HTML pages bookmarked, I want to give them a meaningful error message...
1
by: amitbadgi | last post by:
I am gettign this error while converting an asp application to asp.net , its a query syntax error, Exception Details: System.Runtime.InteropServices.COMException: Syntax error in query expression...
1
by: amitbadgi | last post by:
Hi I am converting an asp application to asp.net, I am geeting the following error, Compiler Error Message: BC30201: Expression expected. Source Error: Line 299:<li><a
2
by: Ben Amada | last post by:
Hello, A partner is going to be creating some HTML files that I plan on converting to user controls (UC) and dynamically load at runtime. I'm guessing Visual Studio doesn't come with some...
9
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP...
3
by: varuna | last post by:
Hi, I have doubt on converting html page to .net i mean if i designed a page in frontpage or in a Dreamweaver so that page i mean instead of designing a web page in .net using toolbox i need to...
6
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Is there a function in VS or a utility that will take an HTML file and create a code-behind ASPX page? The idea is, I'd like to be able to have someone develop beautiful, fully functional HTML...
25
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have...
1
by: Alexander Higgins | last post by:
>>Thanks for the response.... Point Taken but this is not the case. Thus, if a person writes a text file on her or his computer and does not use UNICODE to save it, the current code page is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.