469,927 Members | 1,777 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Streaming Word-Document Problems

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
Jul 19 '05 #1
0 2635

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Markus Ernst | last post: by
1 post views Thread by WildHare | last post: by
3 posts views Thread by A.M-SG | last post: by
2 posts views Thread by mpaliath | last post: by
8 posts views Thread by Amjad | last post: by
2 posts views Thread by SPG | last post: by
8 posts views Thread by Tony K | last post: by
5 posts views Thread by pmakoi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.