XMLHTTP download remote Data output to browser

Source: Internet
Author: User
Tags object zip
xml| Browser | data | download

Use the XMLHTTP object to get the remote data, and then output the data to the client browser with binary, so that the customer downloads it, this example obtains a compressed package from a remote server and outputs it to the browser to provide the customer download.

Program code:
<%
Response.Buffer = True
Dim objXmlHttp, XML
Set XML = Server.CreateObject ("microsoft.xmlhttp") ' Create object

Xml. Open "Get", "Http://www.4guysfromrolla.com/webtech/code/mitchell-pres.zip", False ' Set object, specific XMLHTTP detailed use method see: http:// www.cnsxml.com/blogview.asp?logID=273 the article "XMLHTTP object and its method"

Xml. Send ' sends a request

Response.AddHeader "Content-disposition", "Attachment;filename=mitchell-pres.zip" ' Add header to this file

Response.ContentType = "Application/zip" Set Output type

Response.BinaryWrite xml.responsebody ' output binary to browser

Set xml = Nothing
%>

----------------------------------------------
Ouyangdongjie Creation (Reprint please keep this information)
Www.cnsxml.com
qq:2596812 msn:xzskyweb@hotmail.com
----------------------------------------------









Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.