利用xmlhttp對象獲取遠程的數據,然后用二進制輸出到客戶瀏覽器,讓客戶下載數據,此例從某一遠程服務器獲取一個壓縮包,并且輸出到瀏覽器提供客戶下載。
程序代碼:
<%
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP") '創建對象
xml.Open "GET","遠程下載地址",False '
xml.Send '發送請求
Response.AddHeader "Content-Disposition", "attachment;filename=文件名" '添加頭給這個文件
Response.ContentType = "application/zip" '設置輸出類型
Response.BinaryWrite xml.responseBody '輸出二進制到瀏覽器
Set xml = Nothing
%>
新聞熱點
疑難解答