The following samples are written as console applications. However the code can easily be ported to a Windows Form application or an ASP.NET Application. 

Note: If you decide to copy any of these code samples into an ASP.NET application, be sure to change any Console.Write(...) calls  to Response.Write(...).

 

Here is a list of the following examples:

Quickstart:

Simple MHT Example
A simple code example for converting a Url to a MHT document.

Simple MHT Example with Logging
A simple code example builds upon the previous example, except it demonstrates logging.

MHT as a Byte Array
This example converts a URL to a MHT formatted byte array.

MHT as a String
This example converts a URL to a properly MHT formatted string.

MHT as a Zip file
This example converts a URL to a zip archive with single MHT document.

MHT from a String
The previous examples built a MHT document from a URL. This example builds a MHT document from a HTML string.

MHT from a File
The previous examples built a MHT document from a URL. This example builds a MHT document from a HTML file located on the filesystem.

 

Advanced Examples:

Loading a Url from behind a Proxy
This example demonstrates how to set various properties on the MHT object to use a proxy server.

Loading a Url from a url that requires Authentication
This example demonstrates how to set a username and password to download password protected content.

Loading a Url protected by Forms Authentication
This example demonstrates how successfully download content protected by Forms Authentication.

 

If you have any other suggestions of examples or tutorials using aspNetMHT, please send your request to support@advancedintellect.com