Programmatically display .MHT files inline

Discussion in 'ASP .Net' started by srivalli chavali via DotNetMonster.com, May 18, 2005.

  1. Hi.

    I have a PDF file and a MHT file.
    Following is the code I'm using to read the file and display it INLINE in
    the browser.
    PageData is a MemoryStream object that contains the file's actual stream of
    bytes.

    ---------------------------- PDF files ----------------------------
    Response.ContentType = "application/pdf";
    Response.AddHeader("Content-Type", "application/pdf");
    Response.AddHeader("content-disposition", "inline;filename=file.pdf");
    PageData.WriteTo(Response.OutputStream);

    ---------------------------- MHT files ----------------------------
    Response.ContentType = "message/rfc822";
    Response.AddHeader("Content-Type", "message/rfc822");
    Response.AddHeader("content-disposition", "inline;filename=file.mht");
    PageData.WriteTo(Response.OutputStream);

    Using the above code, I can successfully view the PDF files, but NOT MHT
    files.
    For MHT files, Blank IE window appears and the "View Source" displays the
    following HTML.
    ----
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-
    1252"></HEAD>
    <BODY></BODY></HTML>
    ----
    Please note that I can view both PDF and MHT files successfully as
    attachments, as opposed to being inline.
    i.e., Response.AddHeader("content-disposition",
    "attachment;filename=file.mht"); works absolutely fine.

    I'm wondering if MHT files can be viewed inline at all. If yes, please let
    me know where I'm doing it wrong.

    Thanks in advance.

    -Srivalli.

    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200505/1
     
    srivalli chavali via DotNetMonster.com, May 18, 2005
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. srivalli chavali via DotNetMonster.com

    Programmatically display .MHT files inline

    srivalli chavali via DotNetMonster.com, May 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,779
    DanielSands
    Mar 19, 2010
  2. =?Utf-8?B?U3JpdmFsbGk=?=

    Programmatically display .MHT files inline

    =?Utf-8?B?U3JpdmFsbGk=?=, May 20, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    673
    =?Utf-8?B?U3JpdmFsbGk=?=
    May 20, 2005
  3. =?Utf-8?B?cm9kY2hhcg==?=

    mht files

    =?Utf-8?B?cm9kY2hhcg==?=, Oct 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    585
    =?Utf-8?B?cm9kY2hhcg==?=
    Oct 25, 2005
  4. altamir

    IE6 doesn't display MHT files

    altamir, May 6, 2004, in forum: HTML
    Replies:
    10
    Views:
    7,711
    Toby A Inkster
    May 8, 2004
  5. AAaron123
    Replies:
    1
    Views:
    1,298
    Alexey Smirnov
    Nov 17, 2009
  6. Tarren

    programmatically make .MHT files

    Tarren, Aug 23, 2004, in forum: ASP General
    Replies:
    0
    Views:
    216
    Tarren
    Aug 23, 2004
  7. Sven Wolf
    Replies:
    7
    Views:
    355
    Tad McClellan
    Dec 3, 2004
  8. Vincent Belaïche

    HTML to MHT conversion programmatically

    Vincent Belaïche, Apr 24, 2013, in forum: Perl Misc
    Replies:
    3
    Views:
    464
    Vincent Belaïche
    May 11, 2013
Loading...