Search Persits Software Knowledge Base

 

Article PS100721176

SendBinary fails under IIS7 on Vista, Windows 2008 and 7

Problem Description

Under IIS7, the method SendBinary does not appear to work properly. Depending on which browser you use, a file download fails with the error

Internet Explorer cannot display the webpage

or

This webpage is not available

or

Connection closed by remote server

Solution

The problem has been traced to the Response.AddHeader call

Response.AddHeader( "Content-Length", Size )

that the SendBinary method calls internally. Apparently, under IIS7, the Content-Length header must not be set if Chunked Encoding is used.

To fix the problem, you therefore have two options:

Option 1:

Set both the Enable Buffering and Enable Chunked Encoding options to False under the ASP section in IIS Manager:

Option 2:

Call SendBinary with the 2nd argument set to False. You will then be responsible to provide the values for the Content-Type and Content-Disposition headers. For example:

<%
   Set Upload = Server.CreateObject("Persits.Upload")
   Response.ContentType = "application/octet-stream"
   Response.AddHeader "Content-Disposition", "filename=name.ext"

   Upload.SendBinary Path, False
%>

Created: 7/21/2010 2:36:22 PM
Last Modified: 3/22/2011 11:58:56 AM

Copyright © Persits Software, Inc. 1998 - 2018
For technical support, write to support@persits.com.