473,395 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using SFTP/SCP for file transfer

I am developing a component that will download a file from our FTP
server and it is working. I am curious as to how I can make the FTP
session secure. I've seen a lot of components for sale but I don't
think that is necessary if I can accomplish this with a few more lines
of code. Here is my vb I'm using:

If (RTrim(Me.Filename.Text.ToString) <"") Then
sFileName = Me.Filename.Text
'MsgBox("Get File: " & sFileName)
Dim uri As New Uri("ftp://ftp.myserver.com/" & sFileName)
If (uri.Scheme = uri.UriSchemeFtp) Then
Dim request As FtpWebRequest =
FtpWebRequest.Create(uri)
request.Credentials = New NetworkCredential("username",
"password")

request.UseBinary = True
request.Method = WebRequestMethods.Ftp.DownloadFile
Dim Response = request.GetResponse()
Dim responseStream As IO.Stream =
Response.GetResponseStream()
Dim fs As New IO.FileStream("c:\" & sFileName,
FileMode.Create)
Dim buffer(2047) As Byte
Dim read As Int32 = 0
Do
read = responseStream.Read(buffer, 0,
buffer.Length)
fs.Write(buffer, 0, read)
Loop Until read = 0
fs.Flush()
fs.Close()
responseStream.Close()
Response.Close()

End If
Else
MsgBox("Please enter a file name to download")
End If

As I said this code is working perfectly, I just need to know how to
make my ftp session secure. Thanks for any help.

Jul 14 '06 #1
0 1372

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: adamsbarker | last post by:
i'm using Windows to access an ssh server. everything works perfect until i try executing files (ssh2_exec) and sending/receiving files (ssh2_scp_send/ssh2_scp_recv)... in the function manual at...
0
by: Greg Lindstrom | last post by:
Can anyone point me to a "how-to" on Paramiko? I need to use sftp for file transfer, have installed Paramiko and have a connection (that was pretty easy, actually), but cannot find documentation...
3
by: Bob Hollness | last post by:
Hi all. Rather than use a component or DLL from a 3rd party, has anybody ever written code to allow VB.Net to connect to a SSH ftp server? i.e. rather than ftp a file, it uses sftp (secure...
7
by: RadhakrishnanR | last post by:
How i can implement SFTP in VB. Scenario is I want to take file from SFTP server, then after some process with the file , file will be moved to database.. Our requirement is very clear that how...
1
by: RadhakrishnanR | last post by:
Hi, How to copy a file from SFTP server to local PC using Batch file. Please consider that SFTP server is installed in Linux OS NOT in Windows OS. i.e. I need Batch file script to do the above...
3
by: Lad | last post by:
Is there a module in Python available that I can use for uploading files via SFTP (SSH File Transfer Protocol)? Or do you think that FTP protocol for files uploading is OK? Thank you for replies...
12
by: jcor | last post by:
Hi, I'm using Ubuntu 7.04. I'm writing a sript that sends files via ftp for several destinations. So far I used Net::FTP and it worked fine. My problem is that I need to send files via SFTP...
4
by: sa6113 | last post by:
I want to use sftp from paramiko to copy a file from a windows machine to a Linux in the network, I use this code : host = "LinuxComputerName" (or its Ip) port = 22 transport =...
2
by: sivashanmugam | last post by:
Hi Friends, I tried to send some zips from local to remote location but the transfer is not sucess i can transfer the zips partially can some one assist me how to make it as sucess i had...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.