I want to send the file via FTP on server using vb.net(Vs 2003,framework 1.1) is throwing an exception
AN EXCEPTION OCCURED DURING THE WEBCLIENT REQUEST
The same code is working fine in .Net 2008. I have no Idea why its throwing the exception.
Imports System.Data.SqlClient
Imports System.Text
Imports Microsoft.VisualBasic
Imports System.Net.WebRequest
Imports System.Net.WebClient
Imports System.Net
Imports System.IO
If (Directory.Exists(directoryPath)) Then
arrFileList = Directory.GetFiles(directoryPath) '''Getting All files
Else
MessageBox.Show("Directory not Exist")
End If
For i As Integer = 0 To i < arrFileList.Length - 1
Try
Dim fileName As String = arrFileList.GetValue(i)
Dim toUpload As New FileInfo(fileName)
Dim client As New WebClient
Dim nc As New NetworkCredential("xxxx", "xxxx")
Dim addy As Uri
addy = New Uri("ftp://1xx.xx.xxx.xxx/HYPOSII_FTP/Test/" & toUpload.Name.ToString())
client.Credentials = nc
Dim arrReturn As Byte() = client.UploadFile(addy.ToString(), fileName) //This Line Throwing error
MessageBox.Show("File Uploaded Sucessfully")
FLAG = True
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Next