ASP 使用ADODB.Stream 二进制输出图片:

<%
Function ReadBinaryFile(FileName) '定义函数,用ADODB.Stream读取二进制数据
  Const adTypeBinary = 1
  Dim BinaryStream
  Set BinaryStream = CreateObject("ADODB.Stream")
  BinaryStream.Type = adTypeBinary
  BinaryStream.Open
  BinaryStream.LoadFromFile FileName
  ReadBinaryFile = BinaryStream.Read
End Function

Response.AddHeader "Content-Disposition", "attachment;filename=photo.bmp" '文件名
Response.ContentType = "image/GIF"
response.Binarywrite ReadBinaryFile(server.mappath("photo.bmp")) '就是你读取存在本地的文件,防止被别人知道真实路径盗连的。
%>