Question FtpWebRequest and Firewall settings

fredX

Member
Joined
May 8, 2011
Messages
5
Programming Experience
10+
Hi,

I am trying to send (upload) a file to a remote server using System.Net.FtpWebRequest, but the only way I can get it to succeed is by opeing my Firewall to both inbound and outbound TCP traffic on all ports. I have tried restricting it to the obvious ports 20 and 21, but without siuccess. (Trouble is, I think, with my limited understanding of FTP protocols, is that it also uses randomly assigned ports > 1023.)

Also, even then only works with
Dim ftp1 As FtpWebRequest
ftp1.UsePassive = False

which isn't necessarily an issue in itself...

btw, I am on a Win7 machine. The error returned is a timeout one - the Firewall is evidently blocking it - I would be grateful for any advice

thanks
fX
 
In active Ftp mode data port is inbound to client, in passive mode data port is outbound from client. FtpWebRequest will not allow you to specify which data port to use in active mode, it will be a random port, but you may be able to open inbound traffic coming from servers outbound data port which is 20.
 
Thanks - and sorry for posting in wrong forum (actually I mis-read VS for VB, but even so..)

Pardon my ignorance of these matters, but won't the receiving server's (the client in this case) port 20 be open anyway, as I can FTP in to that using regular FTP s/w anyway? But using said s/w I have to not use PASV mode - it's a Win2008 server, adn am not sure how to tell it to allow PASV FTP connections... I really don't know what to do about this, as I presume opening all ports on my sendiong machine (a backup "server" running WIn7) to TCP traffic is not a good idea...

[edit] I did try specifying a new rule on the receiving server to open port 20 to TCP traffic but it made no difference. But as I said, surely it's open anyway?)
 
Back
Top