How to download a file from Server to client local pc without user intervention?

  • Thread starter Thread starter Ashok
  • Start date Start date
A

Ashok

Dear Friends,

How to download a file from server to client local pc without user
intervention ie without the save as popup window.

Can you give me step by step.

Thanks
 
Ashok,

That should be normally prevented by the securitiy options. It should be
impossible without any user intervention, if that user has not loaded any
special software from you that makes that possible (what is of course an
action).

I hope that this gives an idea,

Cor
 
With VB.NET, I use two methods: You may use ftp connection or internal My.Computer.Network.UploadFile/DownloadFile commands...


Public Sub Upload()



''Upload file

'Dim ftp As FtpWebRequest

'ftp = FtpWebRequest.Create(Url & "/" & ReportFile)

'ftp.Method = WebRequestMethods.Ftp.UploadFile

'Dim sourceStream As New StreamReader(Application.StartupPath & "\" & ReportFile)

'Dim fileContent As String = sourceStream.ReadToEnd()

'sourceStream.Close()

'ftp.ContentLength = fileContent.Length

'Dim fileBytes() As Byte

'Dim encoding As New System.Text.ASCIIEncoding()

'fileBytes = encoding.GetBytes(fileContent)



'ftp.Credentials = New NetworkCredential(login, pass)

'Dim requestStream As Stream = ftp.GetRequestStream()

'requestStream.Write(fileBytes, 0, fileContent.Length)

'requestStream.Close()

'Dim response As FtpWebResponse = ftp.GetResponse()

'Console.WriteLine("Upload status: {0}", response.StatusDescription)

'response.Close()

''Delete file

'Dim ftp As FtpWebRequest = WebRequest.Create(Url & "/" & UserFile)

'ftp.Method = WebRequestMethods.Ftp.DeleteFile

'ftp.Credentials = New NetworkCredential(Login, Pass)

'Dim response As FtpWebResponse

'Try

' response = ftp.GetResponse

' Console.WriteLine("Delete status: {0}", response.StatusDescription)

' response.Close()

'Catch ex As Exception

' 'Console.WriteLine("Delete status: {0}", response.StatusDescription)

'End Try

'Exit Sub



Dim _Updated As Boolean = True

Try

'Url = "http://ftp.domain.com/folder/"

My.Computer.Network.UploadFile(Application.StartupPath & "\" & UserFile, Url & "/" & UserFile, Login, Pass, False, 30 * 1000, FileIO.UICancelOption.DoNothing)

Catch ex As Exception

_Updated = False

Debug.Print("UPLOAD USERFILE FAIL: " & UserFile)

End Try

End Sub
 
Ashok said:
How to download a file from server to client local pc without user
intervention ie without the save as popup window.

'WebClient.DownloadFile'.
 
Back
Top