InetASP Test


<% rem ************************************************************************* rem * rem * This is certainly not the way I would implement an "industrial strength" rem * FTP system. I would probably create a job queue that offloads the rem * processing onto another system besides IIS with IIS simply serving as rem * the gateway to the interface but that is "for another day". rem * rem * Session timeout's become an issue for files that take longer to transfer than rem * the session timeout will allow. I suspect that the file transfer will continue rem * even after the session times out but I have not tested this. rem * rem * ASPInet.FTP has two methods: rem * FTPGetFile(strHostName, strUserName, strPassword, rem * strRemoteFileName, strLocalFileName, bolOverwrite) rem * FTPPutFile(strHostName, strUserName, strPassword, rem * strRemoteFileName, strLocalFileName) rem * rem * The return value is a boolean indicating success or failure. rem * rem ************************************************************************* FTP_TRANSFER_TYPE_ASCII = 1 FTP_TRANSFER_TYPE_BINARY = 2 Set FtpConn = Server.CreateObject("AspInet.FTP") rem ************************************************************************* rem * rem * GET File Test rem * rem ************************************************************************* if FtpConn.FTPGetFile("ftp.microsoft.com", "anonymous", "user@hostname.net", "/disclaimer.txt", "c:\temp\disclaim.new", true, FTP_TRANSFER_TYPE_BINARY) then Response.Write "

FTP download Success...
" else Response.Write "

FTP download Failed...
" Response.Write "Last Error was: " & FtpConn.LastError end if rem ************************************************************************* rem * rem * PUT File Test rem * rem ************************************************************************* if FtpConn.FTPPutFile("ftp.geocities.com", "jamesnewton", "0832", "index.htm", "c:\techref\index.htm", FTP_TRANSFER_TYPE_BINARY) then Response.Write "

FTP upload Success...
" else Response.Write "

FTP upload Failed...
" end if %>