J
Jason von Bartheld
Hi,
I am building a control in ASP.NET that will cache mhtml pages in a database
and then return those
pages to the browser based on keyword searches. Right now I am doing a test
where I fetch the html page using the
chilkat mht component, convert it to mht format and spit it back out to the
browser. Everything works fine except the encoding setting seem to be
incorrect in this code
protected override void Render(HtmlTextWriter output) {
Chilkat.Mht mht = new Chilkat.Mht();
Response.ContentType = "text/html";
if (mht.UnlockComponent("226401D934A3140")) {
output.Write(mht.GetMHT("http://l36.net/test.html"));
}
}
The results of this, taken from the webbrowser after "view source" show the
valid mhtml that I pasted below.
If you were to view source on the output page, paste the content into
notepad and save it as test.mht with ANSI encoding, things work great. This
leads me to believe that the problem is actually in ASP.NET not
telling the browser to expect mhtml.
Does anybody know what the proper settings for the Response object should
be? I have tried the following
Response.ContentType = "message/rfc822"; //Page cannot be displayed message
Response.AddHeader("Content-Disposition", "attachment;
filename=Report.mht"); --Pops up 'saveas' box that saves the file properly.
I am hoping it is just a problem with these settings.
Thanks,
-Jason
Here is sample output:
content-type: multipart/related; charset="us-ascii"; type="text/html";
boundary="----=_NextPart_516_2b2d_2ec24bf1.75cbb67c_.REL"
MIME-Version: 1.0
Subject: http://www.l36.net
Date: Mon, 24 May 2004 23:35:42 -0400
This is a multi-part message in MIME format.
------=_NextPart_516_2b2d_2ec24bf1.75cbb67c_.REL
content-type: text/html; charset="utf-8"
content-transfer-encoding: quoted-printable
Content-Location: http://www.l36.net/
<h1>SchoolBooks.org</h1>
<h3>We are at a new host and will be back up soon</h3>
------=_NextPart_516_2b2d_2ec24bf1.75cbb67c_.REL--
I am building a control in ASP.NET that will cache mhtml pages in a database
and then return those
pages to the browser based on keyword searches. Right now I am doing a test
where I fetch the html page using the
chilkat mht component, convert it to mht format and spit it back out to the
browser. Everything works fine except the encoding setting seem to be
incorrect in this code
protected override void Render(HtmlTextWriter output) {
Chilkat.Mht mht = new Chilkat.Mht();
Response.ContentType = "text/html";
if (mht.UnlockComponent("226401D934A3140")) {
output.Write(mht.GetMHT("http://l36.net/test.html"));
}
}
The results of this, taken from the webbrowser after "view source" show the
valid mhtml that I pasted below.
If you were to view source on the output page, paste the content into
notepad and save it as test.mht with ANSI encoding, things work great. This
leads me to believe that the problem is actually in ASP.NET not
telling the browser to expect mhtml.
Does anybody know what the proper settings for the Response object should
be? I have tried the following
Response.ContentType = "message/rfc822"; //Page cannot be displayed message
Response.AddHeader("Content-Disposition", "attachment;
filename=Report.mht"); --Pops up 'saveas' box that saves the file properly.
I am hoping it is just a problem with these settings.
Thanks,
-Jason
Here is sample output:
content-type: multipart/related; charset="us-ascii"; type="text/html";
boundary="----=_NextPart_516_2b2d_2ec24bf1.75cbb67c_.REL"
MIME-Version: 1.0
Subject: http://www.l36.net
Date: Mon, 24 May 2004 23:35:42 -0400
This is a multi-part message in MIME format.
------=_NextPart_516_2b2d_2ec24bf1.75cbb67c_.REL
content-type: text/html; charset="utf-8"
content-transfer-encoding: quoted-printable
Content-Location: http://www.l36.net/
<h1>SchoolBooks.org</h1>
<h3>We are at a new host and will be back up soon</h3>
------=_NextPart_516_2b2d_2ec24bf1.75cbb67c_.REL--