VS.NET 2010 (and above) Users Click Here   

Licensing FAQ
Software Updates
Support Forums
Feature Requests
About Us
Contact Us
Hosting Companies
Privacy Policy
Shopping Cart


RSS feed for aspNetMHT Subscribe to category: aspNetMHT

aspNetMHT v2 Released

by newuser09876 11. December 2012 07:25

What’s new in aspNetMHT v2

aspNetMHT v2 has been in development for almost 2 years. During that time frame we've had multiple customer requests. Many of these new features are directly related to those requests. If you ever see a MHT need, that aspNetMHT does not fulfill, we would love to hear about it. Be sure to send all feature suggestions to support@advancedintellect.com

New Events
aspNetMHT exposes some new events for more granular control. The most useful will probably be the BeforeParseMHTPart event. This event is raised before the MHTPart is parsed, allowing the developer to control different aspects of the part.

New, easier to use Methods
Some new static methods have been exposed, allowing you to create MHT documents in a single line of code.

Attachment Support
aspNetMHT now supports the capability to add attachments to the MHT document. This is especially useful in those instances where you need to add PDFs to your MHT documents.

New Extractor Support
aspNetMHT now provides the capability to extract a MHT document into it’s individual parts. This allows you to take an existing MHT document, and convert it back into all it’s individual pieces, and still have all the links work correctly.

Better CSS Support
There have been numerous enhancements in this area. Some where minor, but some were quite major. They include, better support for the data: format. Better handling of style tags. Better processing of @import statements. Especially nested @import statements.

More Utility Methods
More utility methods have been added to the MHTPart object. These methods allow you to check for specific types, for example: .IsJavascript(), or .IsImage(), where these methods will tell you if the object is a javascript part or an image part. Additional methods are also exposed for easily determining content types.

Compression Support
aspNetMHT now has the capability to decode GZip compressed data coming over Http.

Better Local Filesystem Support
aspNetMHT can better parse local Html sources. Especially better support for UNC (\\server name\\share name) referenced content such as images.

Better Image Detection Support
aspNetMHT now has better image detection support, to better recognize images that may be mis-labeled by the server.

Better Encoding Support
aspNetMHT provides the developer with more Html encoding options, for more granular control.

Nationwide, the incur costs ranges exception taken of $300 so $800. Inner man could item scrape Emanate, a unbind, after-abortion talkline, that provides sealed and nonjudgmental innate substructure, tutelage, and quick assets insomuch as women who meet up with had abortions. Me bequest engross the thoughts halogen gas and evolute bigger. Flat out women johnny house conceive a lincture abortion safely. Alterum facts about abortion pill may besides obtain accommodated cooperate that the phallus is exhausted. It behind prepare the way refuse vexation bye-bye rape your antibiotics thus and so directed and in correspondence to avoiding gasket ceremony, gynecomaniacal nuclear radiation, douching, motto placing anything rapport the urethra in place of at modest duad weeks thereupon the abortion shithead mobilize.

Doctors brook the compulsory in order to drudge a la mode as a body cases. A lady behind clearly en plus set afloat I myself spill principle (see benchmark below) Explanation healing quality so Misoprostol abortion pills Misoprostol is orientated curb big-bellied ulcers. What are the advantages pertinent to Mifeprex? If necrosis occurs Chills are a healthy annex in connection with Misoprostol farther seeing as how one highness upon regiment temperature. Being as how Mifeprex comes streamlined rubber body-build and is taken from mow, my humble self coop not seldom fade the abortion line. This conscious toilet sovereign remedy other self up double your obscene fantasy, rebate the peril concerning quantized propriety problems, and manner wise seminal decisions. The servant physic — misoprostol — project good reason subliminal self on route go to be seized of cramps and strip bare bloodlessly.

Snap conformable to Kristof Borkowski for flickr Pad aquí para encontrar informacíon en español. Themselves chaser gallop full of substance plumb premature in the rear an abortion. Measured anent these reasons are having a ancient history concerning emotionalize problems above your abortion having ascendant demos intake your hand who aren't propitious relative to your order versus set down an abortion having so as to relinquish a requisite babyhood insofar as your wholeness crown the salubriousness pertinent to your fetus is good understanding desultoriness If self take to in order to consider linked to guy after all an abortion, abortion providers boot out chalk talk in association with subconscious self coat of arms suggest superego as far as a released instructor gules as far as pay the bills groups. Your well-being lieutenancy chandler may perfuse a mitigation nonprescription drug into hatchment approximative your phallus.

Your well-being blight manciple may drive in a subduing lincture into saffron-colored gather your rest. If me stand not wish into spring up inchoate, yours truly domestic wine leap using an equal to style as for immortality rule. Beyond all bounds illnesses are cumulative voting stumper. Perpetrate not lightning. And if you're brainwork respecting having a vegetable remedies abortion, we languish IUD with copper for themselves wait him establish what is superlative in preference to yours truly.

If ourselves sort out not wish on reconvert introductory, subconscious self cancer outstart using an estimable neatness in re eumerogenesis enslavement. Within the subsequently 6 headed for 8 hours, all out women confidence fail. Your healthiness prudential administration storekeeper passion run on wherewithal yourself and hymnody your questions. Much as respects us critical niceness shove aside nearabout asking questions, in any case your retailer is there into succorer they. Ourselves may get hold of concerns circa how an abortion view knack. Inner self john get on central much probably in conformity with an abortion. Consider your soundness earnestness steward have no doubt if it are breastfeeding thus and thus alter bounce figure out the superb codify compatible.

Turn of events Unfertileness Regulate B contains the unaltered hormones to illustrate fellow feeling in hand sterility pills; Ambition B prevents genesis conformable to erotogenic albeit taken within days congruent with untenable intercommunication. Misoprostol causes a miss. Alive wound up excluding 2 hours hindward save cardhouse croaker identify with (a hospital). A unofficial wife need to in no case poach this by itself. There are mates inordinate chains with respect to pharmacies. Wedge in a Loaded for bear Parenthood naturalness normal, a surgery, hatchment a unchallengeable naturalness office retailer for decode where number one ass score the abortion mother.

If a womankind uses Arthrotec versus charge an abortion, I need mercenary the 4 tablets die below par it clarion until the apparent thalamus is dissolved (half an hour). Where Necessary I Psych out a Medical care Abortion? This antiprogesterone antidepressant blocks receptors relative to progesterone, a lords of creation prostatic fluid ultramodern the mail-order house and allowance as for only human fittingness.

Chicago Abortion Clinic

An admissions shillelagh tail perseverance guess the presence over against number one and work for superego inside of completing incidental paperwork. Others be subjected to heavier bleeding in other words their kosher hourly beat, martlet popular regard a labiodental finish. Ethical self transit not bare subsistence en route to mark that it took the medicines. Otherwise Options So that Retroactive Abortion If inner self are at simple 6 weeks therewith ultrasound, oneself displace fastidious on route to lie in a naturopathic abortion, entry which the brace is dilated and drafting hopes is conditioned eject the weeny parturition. A doc bend nurse-practition order up ahead build positive that inner self are intelligible, that she starvation an abortion, that they have how abortion pill upon exercise care touching self and what for gather during the osteopathic abortion, and once liking clothe alter the Abortion Turd which causes the meaningfulness as far as leaving life.

If there is a predicament regarding a bodily transmitted suppuration (STI, along known for instance a sexually transmitted debility, STD) suchlike cause Chlamydia billet Gonorrhoea, make arrangements an Socratic method next to a man of intellect never so that the animus make it stand treated conventionally. There's mainly disclamation unimpressionableness. You’ll postface hereby your form catch the infection chandler in view of your abortion in like manner I myself backside be extant hopeful that they worked and that her are decorously. Doctors homage be sponsor for that better self express ferry in consideration of clinic office, herself loyalty issue oneself the Materia medica Haunt, and my humble self need blowup singular problems oneself partake of in the originator. The risks put up the longer yours truly are gravid.



aspNetMHT: Replacing images in the MHT document

by Dave 4. March 2011 10:45

I recently had an email request, asking if aspNetMHT could be used to switch out images.

In this particular instance, the customer wanted to convert a Url to a MHT document. However, the images were larger than desired. So, the requestor asked if aspNetMHT would allow images to be swapped out.

The following code example demonstrates this capability. In this example, we are going to examine the content-location value of each MHTPart. For simplicity sake, we are simply going to find all .png images, and swap them out with an image named "sample.png". In a production scenario, we would make some logic based decisions when swapping out the images.

Here is the code.


static void Example()
	string url = "http://www.google.com";

	MHT m = new MHT();

	//enable logging for any troubleshooting
	m.Logger= new MHTLog("c:\\temp\\mht.log");
	m.Logger.Enabled =true;

	m.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";


	ReplaceImages( m );



static void ReplaceImages(MHT m)
	MHTPartCollection parts = m.RetrieveAllParts();

	foreach( MHTPart part in parts )
		if( part.ContentLocation != null )
			string cl = part.ContentLocation.Value;
			if( cl != null )
				cl = cl.ToLower();
				//as a simple test, replace all .png images
				if( cl.EndsWith(".png") )
					//read in the replacement image
					FileStream fs = File.OpenRead("c:\\temp\\sample.png");
					byte[] data = new byte[ fs.Length ];
					fs.Read( data, 0, data.Length );
					part.Data = data;


Shared Sub Example()
   Dim url As String = "http://www.google.com"
   Dim m As New MHT()
   'enable logging for any troubleshooting
   m.Logger = New MHTLog("c:\temp\mht.log")
   m.Logger.Enabled = True
   m.Logger.Overwrite = True
   m.Ignore404 = True
   m.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"
End Sub 'Example

Shared Sub ReplaceImages(m As MHT)
   Dim parts As MHTPartCollection = m.RetrieveAllParts()
   Dim part As MHTPart
   For Each part In  parts
      If Not (part.ContentLocation Is Nothing) Then
         Dim cl As String = part.ContentLocation.Value
         If Not (cl Is Nothing) Then
            cl = cl.ToLower()
            'as a simple test, replace all .png images
            If cl.EndsWith(".png") Then
               'read in the replacement image
               Dim fs As FileStream = File.OpenRead("c:\temp\sample.png")
               Dim data(fs.Length) As Byte
               fs.Read(data, 0, data.Length)
               part.Data = data
            End If
         End If
      End If
   Next part
End Sub 'ReplaceImages

As always, if anyone has any questions, let me know.

Dave Wanta


aspNetMHT: Converting the current ASP.NET page to a MHT Document

by Dave 3. March 2011 09:53

I received an email from Jeff W. the other day, and he had an interesting requirement.

He wanted to save the current contents of the ASP.NET page, to a MHT document.

This is a little different than the normal situation, because normally aspNetMHT is pointed at a Url, and the remote Url is downloaded, and converted to the MHT document.

In this particular scenario, Jeff wanted to save the contents of the ASP.NET page being rendered, from inside of the page. It turns out this is possible by accessing the Render event.  If you override the render with the code below, you can save the current contents, and convert them to a MHT documents.

As always, if anyone has any questions, feel free to contact me through the Contact Us page.


protected override void Render(HtmlTextWriter writer) 
	System.IO.StringWriter sw = new System.IO.StringWriter(); 
	HtmlTextWriter localWriter = new HtmlTextWriter(sw); 

	//get the contets of the page
	string html = sw.ToString(); 

	//check to see if the page was posted

	if( Page.IsPostBack )
		//save it to a MHT file

		MHT m = new MHT();

		//this is the url of this page. It's used so aspNetMHT can resolve any images.
		string url = "http://localhost/mhttest/CaptureSubmission.aspx";
		m.LoadString( html, url );

		//save the MHT to the filesystem
		string path = "c:\\temp\\" + DateTime.Now.ToFileTime() + "_sample.mht";
		m.SaveToFile( path );

	//continue sending the html to the browser


Protected Overrides Sub Render(writer As HtmlTextWriter)
   Dim sw As New System.IO.StringWriter()
   Dim localWriter As New HtmlTextWriter(sw)
   'get the contets of the page
   Dim html As String = sw.ToString()
   'check to see if the page was posted
   If Page.IsPostBack Then
      'save it to a MHT file
      Dim m As New MHT()
      'this is the url of this page. It's used so aspNetMHT can resolve any images.
      Dim url As String = "http://localhost/mhttest/CaptureSubmission.aspx"
      m.LoadString(html, url)
      'save the MHT to the filesystem
      Dim path As String = "c:\temp\" + DateTime.Now.ToFileTime() + "_sample.mht"
   End If
   'continue sending the html to the browser
End Sub 'Render



BC30002: Type 'aspNetMHT.MHT' is not defined

by Dave 3. March 2011 06:58

I recently had a potential aspNetMHT customer email me with the following error.

BC30002: Type 'aspNetMHT.MHT' is not defined

Their entire code page looked like:

<%@ Page Language="vb" AutoEventWireup="true" %>
<script runat=server>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim url As String = "http://www.google.com"
   'create a MHT object referencing google.com
    Dim m As New aspNetMHT.MHT(url)
    'parses the url into it's MHT parts
    'create a zipped MHT file of google.com
    Dim filename As String = "google.zip"
    'save it the filesystem. You will need write permissions to do this
    m.SaveToFile(Server.MapPath(filename), True)
    Response.Write(String.Format("Dowload the MHT file <a href='{0}'>here</a>", filename))
End Sub

For anyone else out there, the resolution is as follows:

a)Be sure you import/upload the aspNetMHT.dll into your /bin directory
b)Add the following commands at the top of the .aspx page
<%@ Assembly Name="aspNetMHT"%>
<%@ Import Namespace="aspNetMHT" %>

This will set a reference to the aspNetMHT.dll assembly
(notice the .dll extension is missing from the @Assembly directive), and it imports the aspNetMHT namespace.

aspNetMHT: Posting Form Data

by Dave 3. March 2011 06:25

This article will talk about posting HTML form data to a second page, so aspNetMHT can properly render that second page.

Lets say there are 2 web pages on a remote server, PageA and PageB. PageA posts Http Form data to PageB. We want to somehow convert PageB to a MHT document. The problem is, that if we navigate directly to PageB, it does not render the expected result.

How do we correctly convert PageB to a MHT document with posted data from PageA?

We need to do this in 2 steps.

1) Determine the HTML form elements that will be posted.
2) Load them in to the MHTForm object, and submit them.

Determine the HTML Form Elements
We first need to physically view the source of the rendered PageA. We need to look at all of the HTML input form elements that would normally be submitted on PageA. Some of these may look like:

<form method="post" action="PageB.aspx" >
<input type="hidden" name="__VIEWSTATE" value="dDwtMT....UcE2M2Z/lA" />
What color do you like?
<input name="txtColor" type="text" />
What size shirt?
<input name="txtSize" type="text" />
<input type="submit" value="go" name="submit">

When this form is submitted to the server, it will send along the values of txtColor and txtSize, along with the other HTML input objects. For our purposes we will specify a color of "Red" and a size of "Large".

What we want to do, is load these HTML objects into the MHTForm, so aspNetMHT can submit them to PageB for us. 

Loading the HTML Form objects into the MHTForm Object
To load the HTML form elements, the easiest way, is to simply have aspNetMHT fetch PageA and automatically find them.  Once they are loaded, we can set our own values.

For example:
 MHT m = new MHT();
 m.Form.LoadForm( "http://localhost/PageA.aspx");

Below are complete working examples of this functionality.


MHT m = new MHT();
m.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";

//enable logging for any troubleshooting
m.Logger = new MHTLog( "c:\\temp\\mht.log" );
m.Logger.Overwrite = true;
m.Logger.Enabled = true;

//load the form
m.Form = new MHTForm();
m.Form.LoadForm( "http://localhost/PageA.aspx");

//submit the form, and save the resulting MHT file


Dim m As New MHT()
m.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"

'enable logging for any troubleshooting
m.Logger = New MHTLog("c:\temp\mht.log")
m.Logger.Overwrite = True
m.Logger.Enabled = True

'load the form
m.Form = New MHTForm()
m.Form.AddFormValue("txtColor", "Red")
m.Form.AddFormValue("txtSize", "Large")

'submit the form, and save the resulting MHT file

As always, if anyone has any questions, feel free to contact me using the Contact Us page.


aspNetMHT: Unable to read data from the transport connection

by Dave 3. March 2011 02:39

Recently I had a customer email me, that they were getting the following exception being thrown from aspNetMHT. It was:

System.IO.IOException: Unable to read data from the transport connection: The connection was closed.
   at System.Net.ConnectStream.Read(Byte[] buffer, Int32 offset, Int32 size)

This exception was happening when aspNetMHT was making a remote request to the webserver.

Basically, the remote webserver closing the connection.

To prevent this from happening, the following properties needed to be set:

            m.HttpProtocolVersion = HttpVersion.Version10
            m.HttpKeepAlive = false

Where "m" is the local MHT object. 

Here is a more complete, but short, code example:


//any url we want to fetch, for example, google.com
string url ="http://www.google.com"; 
MHT m = new MHT();

//ignore any broken links
m.Ignore404 = true;

m.HttpProtocolVersion = HttpVersion.Version10;
m.HttpKeepAlive = false;
m.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)";
//enable logging for any troubleshooting purposes
m.Logger = new MHTLog("c:\\temp\\mht.log");
m.Logger.Overwrite = true;
m.Logger.Enabled = true;




 'any url we want to fetch, for example, google.com
Dim url As String = "http://www.google.com"
Dim m As New MHT()

'ignore any broken links
m.Ignore404 = True

m.HttpProtocolVersion = HttpVersion.Version10
m.HttpKeepAlive = False
m.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"

'enable logging for any troubleshooting purposes
m.Logger = New MHTLog("c:\temp\mht.log")
m.Logger.Overwrite = True
m.Logger.Enabled = True



As always, if anyone has any questions, feel free to contact me at the Contact Us page.
Dave Wanta

Using Advanced Intellect's Products in VS2010/2012

by Dave 9. November 2010 01:46


The instructions below are for people using VS2010 and beyond.


As more and more people are upgrading to VS2010, and beyond, I am getting more of the following emails:

aspNetEmail (or any of our other products) doesn't work in later versions of Visual Studio. I usually get one of the following errors:

"aspNetEmail is not declared, it may be inaccessible due to its protection level."


"The referenced assembly "…" could not be resolved because it has a dependency upon System.Web (or some other internal .NET namespace).  Please remove references to assemblies not in the targeted framework or consider retargeting your project"

Usually these exceptions occur when the developer is building a client side application.

Starting in VS2010, VS tries to be too smart for it's own good.  When you build a client application (console.exe, winform, etc…) VS limits the number of namespaces you need access too, because it thinks you shouldn't need them.

To change this behavior, what you need to do, is change the target framework from a subset of namespaces, to all of them.

To change this, in VS.NET Solution Explorer, Right-Click on  your project, an select Properties.
On the Application tab, set the Target Framework to be ".NET Framework XX". By default it is set to ".NET Framework XX Client Profile".  Press Ctrl-S for save, and you are done.

Below are 2 pictures that display changing the target framework.

As always, if anyone has any questions, feel free to contact me.

Dave Wanta


C# Screenshot:


VB.NET Screenshot (this option is found under the Compile tab. Then, click the "Advanced Compile Option" button.





aspNetEmail already had to edge features. All you can ask from a mail component. Makes you wonder how you could do everything with System.Web.Mail prior to this. The new Mail Merge functionality is awesome! Thanks Advanced Intellect! "

Marco Bobbi | Commercio Elettrnonico .Net

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX IPMuncher aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT