home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 37 / IOPROG_37.ISO / SOFT / ASPNET20.ZIP / INETFTP.ASP < prev    next >
Encoding:
Text File  |  1997-07-15  |  2.4 KB  |  67 lines

  1. <html>
  2. <head><title>InetASP Test</title><head>
  3. <body bgcolor=white text=black>
  4. <H2>InetASP Test</H2>
  5. <pre>
  6. <font color=red size=+2>
  7. </pre>
  8. </font>
  9. <%
  10.  
  11.   rem *************************************************************************
  12.   rem *
  13.   rem * This is certainly not the way I would implement an "industrial strength"
  14.   rem *    FTP system. I would probably create a job queue that offloads the
  15.   rem *    processing onto another system besides IIS with IIS simply serving as
  16.   rem *    the gateway to the interface but that is "for another day".
  17.   rem *
  18.   rem * Session timeout's become an issue for files that take longer to transfer than
  19.   rem *   the session timeout will allow. I suspect that the file transfer will continue
  20.   rem *   even after the session times out but I have not tested this.
  21.   rem *
  22.   rem * ASPInet.FTP has two methods:
  23.   rem *   FTPGetFile(strHostName, strUserName, strPassword,
  24.   rem *              strRemoteFileName, strLocalFileName, bolOverwrite)
  25.   rem *   FTPPutFile(strHostName, strUserName, strPassword,
  26.   rem *              strRemoteFileName, strLocalFileName)
  27.   rem *
  28.   rem * The return value is a boolean indicating success or failure.
  29.   rem *
  30.   rem *************************************************************************
  31.  
  32.   FTP_TRANSFER_TYPE_ASCII = 1
  33.   FTP_TRANSFER_TYPE_BINARY = 2
  34.  
  35.  
  36.   Set FtpConn = Server.CreateObject("AspInet.FTP")
  37.  
  38.  
  39.   rem *************************************************************************
  40.   rem *
  41.   rem *  GET File Test
  42.   rem *
  43.   rem *************************************************************************
  44.   if FtpConn.FTPGetFile("ftp.microsoft.com", "anonymous", "user@hostname.net", _
  45.       "/disclaimer.txt", "d:\inetpub\wwwroot\disclaim.new", true, FTP_TRANSFER_TYPE_BINARY) then
  46.      Response.Write "<p>FTP download Success...<br>"
  47.   else
  48.     Response.Write "<p>FTP download Failed...<br>"
  49.     Response.Write "Last Error was: " & FtpConn.LastError
  50.   end if
  51.  
  52.  
  53.   rem *************************************************************************
  54.   rem *
  55.   rem *  PUT File Test
  56.   rem *
  57.   rem *************************************************************************
  58.   rem if FtpConn.FTPPutFile("localhost", "anonymous", "user@hostname.net", "command.com", "c:\command.com", FTP_TRANSFER_TYPE_BINARY) then
  59.   rem   Response.Write "<p>FTP upload Success...<br>"
  60.   rem else
  61.   rem   Response.Write "<p>FTP upload Failed...<br>"
  62.   rem end if
  63. %>
  64.  
  65. </body>
  66. </html>
  67.