IIS7 Binary Stream Error

Posted by WDuffy on Server Fault See other posts from Server Fault or by WDuffy
Published on 2010-04-21T17:23:44Z Indexed on 2010/04/21 17:33 UTC
Read the original article Hit count: 339

Filed under:
|

I'm struggling to understand the problem I'm seeing so please accept my apology if the question is vague. I'm running a classic asp app in IIS7 and everything seems to work fine except for one issue that has me stumped.

Basically, files can be downloaded from the server which is done using the sendBinary method of Persits ASP Upload component. This component works fine for uploading etc it's just the downloading I have a problem.

The strange thing is, I cannot have a pure asp page that serves the binary file. Everything works fine in II6, but in II7 there is a strange problem. For example this does not work.

<%
SET objUpload = server.createObject("Persits.Upload")
    objUpload.sendBinary "D:\sites\file.pdf", true, "application/octet-binary", true
SET objUpload = NOTHING
%>

However, if I put anything in front of the asp code the file is served fine.

serve this
<%
SET objUpload = server.createObject("Persits.Upload")
    objUpload.sendBinary "D:\sites\file.pdf", true, "application/octet-binary", true
SET objUpload = NOTHING
%>

I can also write something to the response stream first and it works fine.

<%
Response.Write("server this")
SET objUpload = server.createObject("Persits.Upload")
    objUpload.sendBinary "D:\sites\file.pdf", true, "application/octet-binary", true
SET objUpload = NOTHING
%>

Does anyone have any ideas of what could be causing this or has anyone ran into a similar situation? I'm sure it has something to do with the setup in IIS 7.

© Server Fault or respective owner

Related posts about iis7

Related posts about asp-classic