10月 09, 2015

asp.net FTP上傳檔案和獲取修改時間

        Dim wc As New WebClient()
        wc.Credentials = New NetworkCredential("hello", "***")
        wc.UploadFile("ftp://127.0.0.1/sort.zip", MapPath("sort.zip"))

        Dim ftp As FtpWebRequest = CType(FtpWebRequest.Create("ftp://127.0.0.1/sort.zip"), FtpWebRequest)
        ftp.Credentials = New NetworkCredential("hello", "***")
        ftp.Method = WebRequestMethods.Ftp.GetDateTimestamp
        Dim uu As FtpWebResponse = ftp.GetResponse
        Label1.Text = uu.LastModified

沒有留言: