【www.gdgbn.com--远程及网络应用】

asp下载远程服务器文件[rar,jpg,gif,zip,png]
< %
function   downfilea(d_target,   s_target)
On   Error   Resume   Next  
    dim   myhttp,   objstream
    set   myhttp   =   server.createobject( "MSXML2.XMLHTTP ")
    myhttp.open   "GET ",   d_target,   false
    myhttp.send()
    set   objstream   =   Server.CreateObject( "adodb.stream ")  
    objstream.Type   =   1  
    objstream.Mode   =   3  
    objstream.Open
    objstream.Write   myhttp.responseBody
    objstream.SaveToFile   s_target,   2
    if   err.number   <>   0   then   err.Clear
end   function
 
downfilea   "http://www.111cn.net/xxx.rar ",   Server.MapPath( "down/xxx.rar ")
Response.write   "ok "
%>
还有asp.net版本的源码(未测试)

   using   System;  
  using   System.Net;  
  using   System.IO;  
 
  class   DownloadFile;  
      {  
        static   void   Main(string[]   args)  
            {  
                //你的远程文件  
                string   siteURL="http://www.abc.com/xxx.rar";  
                //下载到本地的路径及文件名  
                string   fileName="c:\xxx.rar";  
                //实例化一个WebClient  
                WebClient   client=new   WebClient();  
                //调用WebClient的DownloadFile方法  
                client.DownloadFile(siteURL,fileName);  
                }  
        }

本文来源:http://www.gdgbn.com/asp/21953/