I am trying to display mht files that are being generated using ActiveReports. The code below shows how I am trying to display these to the users.
Response.ClearHeaders()
Response.ClearContent()
Response.AddHeader("Content-Disposition", "attachment; filename=Certificate.mht")
Response.WriteFile("Certificate.mht")
Response.Flush()
Response.Close()
If I select Save and save the file to my desktop it can then be opened and display just fine through IE. If, however, I select to open the attachment it displays the mst file without the images included.
I'm using IE7 on a machine running xp sp3. The odd part is that the files do correctly open in IE6 (and firefox using the UnMHT addon) just not IE7. Is this a bug of some sort or am I doing something wrong? I don't think it has anything to do with the mht files being generrated by ActiveReports since they open just fine from the desktop.
I have tried setting the content type using both Response.CotentType and Response.AddHeader("Content-Type", ...) but IE seems to ignore these content types if the file has a known extension. If I set Response.Cache.SetCacheability(HttpCacheability.NoCache) so that there is no cacheing, the content type must then be supplied. I'm not sure why those are even related.
I haven't been able to find much documentation on this stuff either so any links to that would also be appreciated.
Thanks in advance for any replies :)