1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      vb.netftp訪問 vb ftp

      vb.net2008如何操作FTP服務(wù)器?比如登錄并保持登錄狀態(tài),然后遍歷根目錄及指定的目錄,以獲

      具體方法如下:”、打開Serv-U的配置管理界面puzb在“全局用戶”或者“域用戶”中選擇“創(chuàng)建cgko修改和刪除用戶帳戶”; 2、在“創(chuàng)建,修改和刪除用戶帳戶”的界面,選擇“添加”。;3、在“用戶屬性“對話框,“用戶信息”下的用戶名為:Anonymous,密碼為空,為其指定FTP的根目錄。 4、然后在“目錄訪問“選項,點擊“添加”,為其指定訪問權(quán)限和目錄。 5、最后點擊“保存”6這樣我們就成功添加了匿名用戶。

      目前創(chuàng)新互聯(lián)公司已為上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、成都網(wǎng)站托管、企業(yè)網(wǎng)站設(shè)計、思茅網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

      跪求VB.NET 連接FTP

      Imports System.Net

      Imports System.IO

      Module FtpSample

      Sub Main(ByVal args() As String)

      If args.Length = 0 OrElse args(0).Equals("/?") Then

      DisplayUsage()

      ElseIf args.Length = 1 Then

      Download(args(0))

      ElseIf args.Length = 2 Then

      If args(0).Equals("/list") Then

      List(args(1))

      Else

      Upload(args(0), args(1))

      End If

      Else

      Console.WriteLine("Unrecognized argument.")

      End If

      End Sub

      Private Sub DisplayUsage()

      Console.WriteLine("USAGE:")

      Console.WriteLine(" FtpSample [/? | FTP download URL | local file")

      Console.WriteLine(" FTP upload URL | /list FTP list URL]")

      Console.WriteLine()

      Console.WriteLine("where")

      Console.WriteLine(" FTP download URL URL of a file to download from an FTP server.")

      Console.WriteLine(" FTP upload URL Location on a FTP server to upload a file to.")

      Console.WriteLine(" FTP list URL Location on a FTP server to list the contents of.")

      Console.WriteLine(" local file A local file to upload to an FTP server.")

      Console.WriteLine()

      Console.WriteLine(" Options:")

      Console.WriteLine(" /? Display this help message.")

      Console.WriteLine(" /list Specifies the list command.")

      Console.WriteLine()

      Console.WriteLine("EXAMPLES:")

      Console.WriteLine(" Download a file FtpSample ")

      Console.WriteLine(" Upload a file FtpSample upload.txt ")

      End Sub

      Private Sub Download(ByVal downloadUrl As String)

      Dim responseStream As Stream = Nothing

      Dim fileStream As FileStream = Nothing

      Dim reader As StreamReader = Nothing

      Try

      Dim downloadRequest As FtpWebRequest = _

      WebRequest.Create(downloadUrl)

      Dim downloadResponse As FtpWebResponse = _

      downloadRequest.GetResponse()

      responseStream = downloadResponse.GetResponseStream()

      Dim fileName As String = _

      Path.GetFileName(downloadRequest.RequestUri.AbsolutePath)

      If fileName.Length = 0 Then

      reader = New StreamReader(responseStream)

      Console.WriteLine(reader.ReadToEnd())

      Else

      fileStream = File.Create(fileName)

      Dim buffer(1024) As Byte

      Dim bytesRead As Integer

      While True

      bytesRead = responseStream.Read(buffer, 0, buffer.Length)

      If bytesRead = 0 Then

      Exit While

      End If

      fileStream.Write(buffer, 0, bytesRead)

      End While

      End If

      Console.WriteLine("Download complete.")

      Catch ex As UriFormatException

      Console.WriteLine(ex.Message)

      Catch ex As WebException

      Console.WriteLine(ex.Message)

      Catch ex As IOException

      Console.WriteLine(ex.Message)

      Finally

      If reader IsNot Nothing Then

      reader.Close()

      ElseIf responseStream IsNot Nothing Then

      responseStream.Close()

      End If

      If fileStream IsNot Nothing Then

      fileStream.Close()

      End If

      End Try

      End Sub

      Private Sub Upload(ByVal fileName As String, ByVal uploadUrl As String)

      Dim requestStream As Stream = Nothing

      Dim fileStream As FileStream = Nothing

      Dim uploadResponse As FtpWebResponse = Nothing

      Try

      Dim uploadRequest As FtpWebRequest = WebRequest.Create(uploadUrl)

      uploadRequest.Method = WebRequestMethods.

      ' UploadFile is not supported through an Http proxy

      ' so we disable the proxy for this request.

      uploadRequest.Proxy = Nothing

      requestStream = uploadRequest.GetRequestStream()

      fileStream = File.Open(fileName, FileMode.Open)

      Dim buffer(1024) As Byte

      Dim bytesRead As Integer

      While True

      bytesRead = fileStream.Read(buffer, 0, buffer.Length)

      If bytesRead = 0 Then

      Exit While

      End If

      requestStream.Write(buffer, 0, bytesRead)

      End While

      ' The request stream must be closed before getting the response.

      requestStream.Close()

      uploadResponse = uploadRequest.GetResponse()

      Console.WriteLine("Upload complete.")

      Catch ex As UriFormatException

      Console.WriteLine(ex.Message)

      Catch ex As IOException

      Console.WriteLine(ex.Message)

      Catch ex As WebException

      Console.WriteLine(ex.Message)

      Finally

      If uploadResponse IsNot Nothing Then

      uploadResponse.Close()

      End If

      If fileStream IsNot Nothing Then

      fileStream.Close()

      End If

      If requestStream IsNot Nothing Then

      requestStream.Close()

      End If

      End Try

      End Sub

      Private Sub List(ByVal listUrl As String)

      Dim reader As StreamReader = Nothing

      Try

      Dim listRequest As FtpWebRequest = WebRequest.Create(listUrl)

      listRequest.Method = WebRequestMethods.

      Dim listResponse As FtpWebResponse = listRequest.GetResponse()

      reader = New StreamReader(listResponse.GetResponseStream())

      Console.WriteLine(reader.ReadToEnd())

      Console.WriteLine("List complete.")

      Catch ex As UriFormatException

      Console.WriteLine(ex.Message)

      Catch ex As WebException

      Console.WriteLine(ex.Message)

      Finally

      If reader IsNot Nothing Then

      reader.Close()

      End If

      End Try

      End Sub

      End Module

      可以通過設(shè)置 Credentials 屬性來指定用于連接服務(wù)器的憑據(jù),也可以將它們包含在傳遞給 Create 方法的 URI 的 UserInfo 部分中。

      從 FTP 服務(wù)器下載文件時,如果命令成功,所請求的文件的內(nèi)容即在響應(yīng)對象的流中。通過調(diào)用 GetResponseStream 方法,可以訪問此流。

      如果使用 FtpWebRequest 對象向服務(wù)器上載文件,則必須將文件內(nèi)容寫入請求流,請求流是通過調(diào)用 GetRequestStream 方法或其異步對應(yīng)方法(BeginGetRequestStream 和 EndGetRequestStream 方法)獲取的。必須寫入流并在發(fā)送請求之前關(guān)閉該流。

      請求是通過調(diào)用 GetResponse 方法或其異步對應(yīng)方法(BeginGetResponse 和 EndGetResponse 方法)發(fā)送到服務(wù)器的。請求的操作完成時,會返回一個 FtpWebResponse 對象。FtpWebResponse 對象提供操作的狀態(tài)以及從服務(wù)器下載的所有數(shù)據(jù)。

      VB.net連接FTP操作

      MSDN上的,看看對你有沒有幫助。GOOD LUCK!

      Imports System.Net

      Imports System.IO

      Module FtpSample

      Sub Main(ByVal args() As String)

      If args.Length = 0 OrElse args(0).Equals("/?") Then

      DisplayUsage()

      ElseIf args.Length = 1 Then

      Download(args(0))

      ElseIf args.Length = 2 Then

      If args(0).Equals("/list") Then

      List(args(1))

      Else

      Upload(args(0), args(1))

      End If

      Else

      Console.WriteLine("Unrecognized argument.")

      End If

      End Sub

      Private Sub DisplayUsage()

      Console.WriteLine("USAGE:")

      Console.WriteLine(" FtpSample [/? | FTP download URL | local file")

      Console.WriteLine(" FTP upload URL | /list FTP list URL]")

      Console.WriteLine()

      Console.WriteLine("where")

      Console.WriteLine(" FTP download URL URL of a file to download from an FTP server.")

      Console.WriteLine(" FTP upload URL Location on a FTP server to upload a file to.")

      Console.WriteLine(" FTP list URL Location on a FTP server to list the contents of.")

      Console.WriteLine(" local file A local file to upload to an FTP server.")

      Console.WriteLine()

      Console.WriteLine(" Options:")

      Console.WriteLine(" /? Display this help message.")

      Console.WriteLine(" /list Specifies the list command.")

      Console.WriteLine()

      Console.WriteLine("EXAMPLES:")

      Console.WriteLine(" Download a file FtpSample ")

      Console.WriteLine(" Upload a file FtpSample upload.txt ")

      End Sub

      Private Sub Download(ByVal downloadUrl As String)

      Dim responseStream As Stream = Nothing

      Dim fileStream As FileStream = Nothing

      Dim reader As StreamReader = Nothing

      Try

      Dim downloadRequest As FtpWebRequest = _

      WebRequest.Create(downloadUrl)

      Dim downloadResponse As FtpWebResponse = _

      downloadRequest.GetResponse()

      responseStream = downloadResponse.GetResponseStream()

      Dim fileName As String = _

      Path.GetFileName(downloadRequest.RequestUri.AbsolutePath)

      If fileName.Length = 0 Then

      reader = New StreamReader(responseStream)

      Console.WriteLine(reader.ReadToEnd())

      Else

      fileStream = File.Create(fileName)

      Dim buffer(1024) As Byte

      Dim bytesRead As Integer

      While True

      bytesRead = responseStream.Read(buffer, 0, buffer.Length)

      If bytesRead = 0 Then

      Exit While

      End If

      fileStream.Write(buffer, 0, bytesRead)

      End While

      End If

      Console.WriteLine("Download complete.")

      Catch ex As UriFormatException

      Console.WriteLine(ex.Message)

      Catch ex As WebException

      Console.WriteLine(ex.Message)

      Catch ex As IOException

      Console.WriteLine(ex.Message)

      Finally

      If reader IsNot Nothing Then

      reader.Close()

      ElseIf responseStream IsNot Nothing Then

      responseStream.Close()

      End If

      If fileStream IsNot Nothing Then

      fileStream.Close()

      End If

      End Try

      End Sub

      Private Sub Upload(ByVal fileName As String, ByVal uploadUrl As String)

      Dim requestStream As Stream = Nothing

      Dim fileStream As FileStream = Nothing

      Dim uploadResponse As FtpWebResponse = Nothing

      Try

      Dim uploadRequest As FtpWebRequest = WebRequest.Create(uploadUrl)

      uploadRequest.Method = WebRequestMethods.

      ' UploadFile is not supported through an Http proxy

      ' so we disable the proxy for this request.

      uploadRequest.Proxy = Nothing

      requestStream = uploadRequest.GetRequestStream()

      fileStream = File.Open(fileName, FileMode.Open)

      Dim buffer(1024) As Byte

      Dim bytesRead As Integer

      While True

      bytesRead = fileStream.Read(buffer, 0, buffer.Length)

      If bytesRead = 0 Then

      Exit While

      End If

      requestStream.Write(buffer, 0, bytesRead)

      End While

      ' The request stream must be closed before getting the response.

      requestStream.Close()

      uploadResponse = uploadRequest.GetResponse()

      Console.WriteLine("Upload complete.")

      Catch ex As UriFormatException

      Console.WriteLine(ex.Message)

      Catch ex As IOException

      Console.WriteLine(ex.Message)

      Catch ex As WebException

      Console.WriteLine(ex.Message)

      Finally

      If uploadResponse IsNot Nothing Then

      uploadResponse.Close()

      End If

      If fileStream IsNot Nothing Then

      fileStream.Close()

      End If

      If requestStream IsNot Nothing Then

      requestStream.Close()

      End If

      End Try

      End Sub

      Private Sub List(ByVal listUrl As String)

      Dim reader As StreamReader = Nothing

      Try

      Dim listRequest As FtpWebRequest = WebRequest.Create(listUrl)

      listRequest.Method = WebRequestMethods.

      Dim listResponse As FtpWebResponse = listRequest.GetResponse()

      reader = New StreamReader(listResponse.GetResponseStream())

      Console.WriteLine(reader.ReadToEnd())

      Console.WriteLine("List complete.")

      Catch ex As UriFormatException

      Console.WriteLine(ex.Message)

      Catch ex As WebException

      Console.WriteLine(ex.Message)

      Finally

      If reader IsNot Nothing Then

      reader.Close()

      End If

      End Try

      End Sub

      End Module

      可以通過設(shè)置 Credentials 屬性來指定用于連接服務(wù)器的憑據(jù),也可以將它們包含在傳遞給 Create 方法的 URI 的 UserInfo 部分中。

      從 FTP 服務(wù)器下載文件時,如果命令成功,所請求的文件的內(nèi)容即在響應(yīng)對象的流中。通過調(diào)用 GetResponseStream 方法,可以訪問此流。

      如果使用 FtpWebRequest 對象向服務(wù)器上載文件,則必須將文件內(nèi)容寫入請求流,請求流是通過調(diào)用 GetRequestStream 方法或其異步對應(yīng)方法(BeginGetRequestStream 和 EndGetRequestStream 方法)獲取的。必須寫入流并在發(fā)送請求之前關(guān)閉該流。

      請求是通過調(diào)用 GetResponse 方法或其異步對應(yīng)方法(BeginGetResponse 和 EndGetResponse 方法)發(fā)送到服務(wù)器的。請求的操作完成時,會返回一個 FtpWebResponse 對象。FtpWebResponse 對象提供操作的狀態(tài)以及從服務(wù)器下載的所有數(shù)據(jù)。

      vb.net FTP問題?

      If My.Computer.Network.IsAvailable Then

      '如果可用

      Else

      '不可用

      End If

      Public Sub DownloadFile ( _

      address As Uri, _

      destinationFileName As String, _

      userName As String, _

      password As String, _

      showUI As Boolean, _

      connectionTimeout As Integer, _

      overwrite As Boolean, _

      onUserCancel As UICancelOption _

      )

      參數(shù)

      address

      String 或 Uri。要下載的文件的路徑,包括文件名和主機地址。必選。

      destinationFileName

      String。下載文件的文件名和路徑。必選。

      userName

      String。要進行身份驗證的用戶名。默認(rèn)值為空字符串 ""。

      password

      String。要進行身份驗證的密碼。默認(rèn)值為空字符串 ""。

      showUI

      Boolean。指定是否顯示操作進度。默認(rèn)為 False。

      connectionTimeout

      Int32。以毫秒為單位的超時間隔。默認(rèn)值為 100 秒。

      overwrite

      Boolean。指定是否改寫現(xiàn)有文件。默認(rèn)為 False。

      onUserCancel

      UICancelOption。指定當(dāng)用戶在對話框(此對話框在 ShowUI 設(shè)置為 True 時顯示)上單擊“取消”或“否”時的行為。默認(rèn)為 ThrowException。


      標(biāo)題名稱:vb.netftp訪問 vb ftp
      文章位置:http://www.ef60e0e.cn/article/dodojij.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        施甸县| 花垣县| 洛川县| 榆中县| 静乐县| 肥城市| 大厂| 新营市| 敖汉旗| 尤溪县| 呼伦贝尔市| 资阳市| 济阳县| 苍梧县| 罗江县| 安国市| 大连市| 浑源县| 新昌县| 凌源市| 宽甸| 阿拉善右旗| 赤城县| 泸定县| 焦作市| 西吉县| 宿松县| 樟树市| 中阳县| 红河县| 南靖县| 叙永县| 九寨沟县| 余江县| 铜梁县| 梓潼县| 乾安县| 琼结县| 尖扎县| 东乌珠穆沁旗| 甘孜县|