Streaming Word-Document Problems

Discussion in 'ASP General' started by Philipp Lenssen, Dec 17, 2003.

  1. I have a password-protected website with downloads. The
    password-protection needed its own login-screen, so I use a
    session-object. It works well but now I also want the downloads (PDFs
    and Word-Documents) to check if the user is logged-in. When I stream
    PDFs, all works well. When I stream DOCs, the Word-File seems broken
    when I open it -- a lot of strange characters, some authors
    information, and so on.

    Can anybody help me?

    This is my code ("stmPic" is just a left-over from an online sample...):

    response.clear
    if inStr(sPath, ".pdf") >= 1 then
    Response.ContentType = "application/pdf"
    elseif inStr(sPath, ".doc") >= 1 then
    Response.ContentType = "application/msword"
    Response.AddHeader "content-disposition", _
    "attachment; filename=download.doc"
    else ' just a fall-back...
    Response.ContentType = "application/x"
    end if

    set stmPic = Server.CreateObject("ADODB.Stream")

    stmPic.Open
    stmPic.LoadFromFile sPath
    stmPic.Type = 1

    Response.BinaryWrite stmPic.Read
    Response.Flush

    stmPic.Close
    Philipp Lenssen, Dec 17, 2003
    #1
    1. Advertising

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. Jonas

    Streaming Word-document

    Jonas, Jun 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    462
    Kevin Spencer
    Jun 18, 2004
  2. =?Utf-8?B?UGV0ZXI=?=

    streaming word document

    =?Utf-8?B?UGV0ZXI=?=, Jan 4, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    355
    =?Utf-8?B?UGV0ZXI=?=
    Jan 4, 2005
  3. srk
    Replies:
    0
    Views:
    638
  4. srk
    Replies:
    0
    Views:
    607
  5. Michael G. Schneider

    Modifying a Word document without using Word Automation

    Michael G. Schneider, Dec 15, 2003, in forum: ASP General
    Replies:
    5
    Views:
    282
    el.c. - myLittleTools.net
    Dec 16, 2003
Loading...

Share This Page