hello,
iam a newbie in the .net world recently i have been assigned a project by my organization to make a portal using vb.net which would list all the files and folders kept at the server, and i need to add a functionality wherein on a single click the user should be able to download all the files present in a particular a listbox which contains various files selected for the download, iam using file.copy method for this as the files are to be copied in the intranet only but this works fine when i run it on my computer but as soon as i deploy it and in the client server architecture the files are not copied even to the server nor in the client, although no error is shown. I have tried catching the hostname and then copying file to the host's drive but that also doesnt works too after deployment plzz help..
the code iam using is as follows:
Protected Sub btndownload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btndownload.Click
Dim i As Integer
'Dim s(i) As ArrayList
'Dim req As String
'req = Request.ServerVariables("REMOTE_ADDR")
Dim TxtLocalSysName As String = Request.UserHostName
For i = 0 To lstdownload.Items.Count - 1
'If i <> 0 Then
Dim filePath As String = Me.Label5.Text + "\" + lstdownload.Items(i).Text
Dim targetFile As System.IO.FileInfo = New System.IO.FileInfo(filePath)
Dim objFileInfo As FileInfo
objFileInfo = New FileInfo(filePath)
'Dim di As DirectoryInfo = New DirectoryInfo("\\" & TxtLocalSysName & "\c:\ftp420\")
Try
' ' Determine whether the directory exists.
' If Not di.Exists Then
' ' Indicate that it already exists.
' di.Create()
' If FileAttributes.ReadOnly.CompareTo(di.Attributes) Then
' di.Attributes &= Not FileAttributes.ReadOnly
' End If
' ' Response.Write("The directory was created successfully.")
' File.Copy(filePath, "\\" & TxtLocalSysName & "\c:\ftp420\" & objFileInfo.Name)
' filePath = " "
' ' Continue For
' 'Response.Write("That path exists already.")
' 'Return
' Else
File.Copy(filePath, "\\" & TxtLocalSysName & "\c$\downloads\" & objFileInfo.Name)
'End If
' Try to create the directory.
' Delete the directory.
' di.Delete()
' Response.Write("The directory was deleted successfully.")
Catch ex As Exception
Console.WriteLine("The process failed: {0}", ex.ToString())
End Try
' i = i - 1
'End If
Next i
End Sub