msxml.serverxmlhttp组件,获取到responseBody直接用adodb.stream以二进制的形式写入文件 ------解决方案-------------------- Function TransferFile(path, mimeType, filename)
' 下面是不希望下载的文件
FileExt = Mid(filename, InStrRev(filename, ".") + 1)
Select Case UCase(FileExt)
Case "ASP", "ASA", "ASPX", "INC"
Response.Write "受保护文件,不能下载."
Response.End
End Select
Dim objFileSystem, objFile, objStream
Dim char
Dim sent
send=0
TransferFile = True
Set objFileSystem = Server.CreateObject( "Scripting.FileSystemObject")
Set objFile = objFileSystem.GetFile(Path)
Set objStream = objFile.OpenAsTextStream(ForReading, TristateTrue)
Response.AddHeader "content-type ", mimeType
response.AddHeader "Content-Disposition ", "attachment;filename= " & filename
Response.AddHeader "content-length ", objFile.Size
Do While Not objStream.AtEndOfStream