Join Dotnetcodes DotnetCodes.com is online Discussion Forum for Software professionals . It lets you find friends around the world and Create professional network that share similar interests as you. Get help on ur projects by industry specialists. Also get answers to all ur technical/placement related querries.Get an edge over others.
Already MemberClick here to login
ASP.net MVC Interview Questions Answers Interview Questions
Get Started Developing for Android Apps with Eclipse Articles
Serial Number in SSRS Articles
.Net framework 4.0 Interview Questions Answers Interview Questions
SQL server reporting services Interview Questions (SSRS) part 1 Articles
Whats New in ASP.NET 4.0 Part 2 Articles
How to Print a Crystal Report direct to printer Articles
Difference between Encapsulation and Abstraction Interview Questions
Explaining SDLC -System Development Life Cycle Articles
Html5 interview questions and answers Interview Questions
SharePoint 2010 interview Questions Answers Interview Questions
Infosys Interview Questions Interview Questions
Dynamic Menu using HTML List Tag and CSS in ASP.Net Articles
Populate or bind Dropdownlist in Asp.net using Jquery and Json Articles
ASP.NET MVC Overview Interview Questions
Submit Articles | More Articles..

Get Mht from HTml Page

Posted By: [email protected] on 7/13/2010 11:36:48 PM | Comments:3 [Forward This]
Hi coders, I have an html page and i want to convert this to MHT format.I have below solution for. I have used CDO and Introp.ddl to convert but the mht page is not exactly the html page. there is an slightly an change. I have an use case where in html page by click ing on the link using ajax calls the html content will be loaded on a div and i want that html content which is in div along with the other HTml page as an MHT.. is there ant know solutions..?? Thanks in advance. regards Satish.D
Read CommentsComments Category:CSharp Reply to this PostReply

Dear Friends, Dont forget to bookmark and submit your posting to social websites listed above.It will bring more visibility, buzz and fast action to attend your post

Responses to the Discussion: Get Mht from HTml Page
Reply by: [email protected] on: 7/21/2010 12:53:01 AM
HI all, Thanks for the reply. I have already used the below code to get the MHT and it is working fine.Now my use case is like below. 1) We have to navigate to URL www.test.com/test.aspx 2) On the displayed web page there are some links listed on the page. 3) When we click on those links, an HTML content is displayed on the page i.e DIV. 4) If we click on that link some post data has been posted to the some url and the html response data is rendered over the webpage. 5) Now i want that html content on div along with the web html page as MHT format. We have to the solution similar in this way..!! Post the data to the specific url and get the response html content and try to parse as MHT. some thing like that..?? Thanks for the reply and thanks in Advance friends, regards, Satish.
Reply by: [email protected] on: 7/21/2010 12:19:31 AM
Hi satish, You will need to take reference to both the CDO.dll and the ADODB.dll in the project. you can use the following code: CDO.Message msg = new CDO.MessageClass(); ADODB.Stream stm = null; byte[] data; msg.MimeFormatted = true; msg.CreateMHTMLBody("file://"+path, CDO.CdoMHTMLFlags.cdoSuppressNone,"",""); path = path.Replace(".html",".mht"); stm = msg.GetStream(); stm.SaveToFile(path,ADODB.SaveOptionsEnum.adSaveCreateOverWrite); msg=null; stm.Close();
Reply by: rakesh on: 7/13/2010 11:44:28 PM
hey satish, You will will need to reference both the CDO.dll and the ADODB.dll in the project. you can use the following code: CDO.Message msg = new CDO.MessageClass(); ADODB.Stream stm = null; byte[] data; msg.MimeFormatted = true; msg.CreateMHTMLBody("file://"+path, CDO.CdoMHTMLFlags.cdoSuppressNone,"",""); path = path.Replace(".html",".mht"); stm = msg.GetStream(); stm.SaveToFile(path,ADODB.SaveOptionsEnum.adSaveCreateOverWrite); msg=null; stm.Close();
 
You have not Logged In,  click here to Login
Reply Here
 
, I agree the terms and conditions of this website
  
  .NET Framework
  ADO.NET
  AJAX
  Android
  ASP.NET
  ASP.NET AJAX
  ASP.NET MVC
  Azure
  Best Practices
  BizTalk Server
  C++
  CSharp
  CSS
  DBMS
  Error and Resolution
  HTML
  IIS
  JAVA
  JavaScript
  JQwery
  JSP
  LINQ
  Management
  Mobile
  ODP.NET
  OOPS
  Oracle
  Others
  Pattern and Practices
  PHP
  SAP
  SEO
  SharePoint
  Silverlight
  Sql Server
  SSAS
  SSIS
  SSRS
  Survey
  UML
  UNIX
  VB
  VB.NET
  VS 2010
  WCF
  Web Analytics
  Windows Forms
  WPF
  WWF
  XML
  XSLT
  .NET Framework
  ADO.NET
  AJAX
  Android
  ASP.NET
  ASP.NET AJAX
  ASP.NET MVC
  Azure
  Best Practices
  BizTalk Server
  C++
  CSharp
  CSS
  DBMS
  Error and Resolution
  HTML
  IIS
  JAVA
  JavaScript
  JQwery
  JSP
  LINQ
  Management
  Mobile
  ODP.NET
  OOPS
  Oracle
  Others
  Pattern and Practices
  PHP
  SAP
  SEO
  SharePoint
  Silverlight
  Sql Server
  SSAS
  SSIS
  SSRS
  Survey
  UML
  UNIX
  VB
  VB.NET
  VS 2010
  WCF
  Web Analytics
  Windows Forms
  WPF
  WWF
  XML
  XSLT
All rights reserved to dotnetcodes. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
Best viewed at 1024 x 768 resolution with Internet Explorer 5.0 or Mozila Firefox 3.5 or Google Crome and higher