« Previous Next »

Thread: displaying mht files

Last post 10-24-2008 2:14 AM by Andrew Zhu - MSFT. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 10-17-2008, 11:32 AM

    • hexadis
    • Not Ranked
    • Joined on 10-16-2008, 8:11 PM
    • Posts 2

    displaying mht files

    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 :)

  • 10-17-2008, 12:44 PM In reply to

    Re: displaying mht files

    Is static or dynamic compression enabled?  If so, try adjusting that.  I've seen 'strange' behavior with IIS compression and IE.  :)

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-17-2008, 4:04 PM In reply to

    Re: displaying mht files

    Also, you could try setting the ContentType to "message/rfc822"

  • 10-17-2008, 5:44 PM In reply to

    • hexadis
    • Not Ranked
    • Joined on 10-16-2008, 8:11 PM
    • Posts 2

    Re: displaying mht files

    Unless cacheing is turned off, the ContentType seems to be ignored.  If I turn cacheing off setting the ContentType to "message/rfc822" is required to make IE realize its an mht file, but it still loads it without the pictures.

  • 10-20-2008, 12:55 PM In reply to

    • dilworth
    • Not Ranked
    • Joined on 01-05-2006, 2:19 AM
    • Posts 1

    Re: displaying mht files

    I'm having the same type of issue where images in mht files does not display when using IE7 but they do when using IE6.   I tested the mht file when saving in IE6 and IE7 but have the same issue when trying to display the mht file on machines with IE7.

     Did anyone figure out how I need to fix this.?

  • 10-24-2008, 2:14 AM In reply to

    Re: displaying mht files

    We test your code in both IIS6 and IIS7, your issue is recured in our environment. IE 7 cannot decode the image bits to display images which saved by IE6.

    It is a issue caused by IE7 but not IIS.

    Thanks

    Sincerely
    Microsoft Online Community Support
    Andrew Zhu - MSFT


    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Page 1 of 1 (6 items)
Microsoft Communities