The requested FTP command is not supported when using HTTP proxy

  • Thread starter Thread starter chris
  • Start date Start date
C

chris

Hi,

I am trying to upload files on FTP and used the code below:

Dim request As FtpWebRequest

request =
WebRequest.Create("ftp://ftp...../test.txt")
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = New
NetworkCredential(ftp_site_user_name, ftp_site_password)

Dim sourceStream As New
StreamReader("C:\Documents and Settings\.......\text.txt")

Dim filecontents() As Byte =
Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())

sourceStream.Close()
request.ContentLength = filecontents.Length

Dim requestStream As Stream =
request.GetRequestStream()
requestStream.Write(filecontents, 0,
filecontents.Length)
requestStream.Close()

When I define to use proxy (in Interent options/connections/LAN
settings) I receive an error "The requested FTP command is not
supported when using HTTP proxy". When I define NOT to use proxy, the
file is transfered on FTP.

1. Is there a way for defining to bypass the proxy for this ftp
connection ?

2. Can I create subdirectories on FTP from code ?

3. StreamReader reads TXT files. How can I read ZIP files for uploading
on FTP ?

Thanks a lot.
 
Try request.Proxy = nothing;

Hi Chirs,

I am having the same problem. Did you find a solution?

I am new in asp and I also have problems with this exception:

"The requested URI is invalid for this FTP command"

I paste the URI in windows explorer and I don't have any problems.

Any ideas?

Thanks a lot

Savvas
 
Back
Top