The requested FTP command is not supported when using HTTP proxy

Discussion in 'ASP .Net' started by chris, May 31, 2006.

  1. chris

    chris Guest

    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.
     
    chris, May 31, 2006
    #1
    1. Advertisements

  2. 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
     
    savvas.ioannides, Jun 21, 2006
    #2
    1. Advertisements

  3. chris

    Mark Rusnak Guest

    Try request.Proxy = nothing;

     
    Mark Rusnak, Jun 22, 2006
    #3
  4. chris

    nzakir

    Joined:
    Nov 13, 2007
    Messages:
    1
    Likes Received:
    0
    Location:
    Karachi, Pakistan
    request.Proxy = null;
    will solve the problem if you can edit the code.

    if you don't have the access to the code then
    remove the use proxy check in internet explorer settings.
     
    nzakir, Nov 13, 2007
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.