Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to build a program that can capture the contents of a web site to archive page (mht file).
Since the web site need to login and access certain page to get some session variables. I decided to use the webbrowser control (and so I can access the page manually before I start capture the contents).

I think it's easy to change the URL e.g.
webBrowser.Navigate("http://www.google.com")

But below code only allow me to save it to HTML format
VB
Dim MSDNpage As String = webBrowser.DocumentText
My.Computer.FileSystem.WriteAllText("C:\test1.mht";, MSDNpage, True)

Any way to save it to mht? (vb .net)
Thanks in advance.
Posted
Updated 29-Dec-10 18:48pm
v2

Hello,

Have a look at this article, I think it demonstrate what you want to achieve.

Convert any URL to a MHTML archive using native .NET code[^]

Valery.
 
Share this answer
 
Comments
fjdiewornncalwe 30-Dec-10 13:07pm    
An oldy, but a goodie.
I tried to follow the info in the provided URL. However, I found that the downloaded mht file is not working. When open it with IE, it can't show the original web page. (and it's different when compare to the mht file saved with IE).
I found that it should be easier as if I called the
.ShowSaveAsDialog()

However, I don't know how to control the save dialog after it opened. Pls advice. Thx a lot
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900