FtpWebRequest GetResponse throw The server committed a protocol violation :(

Hello.

I have some trouble with FtpWebRequest class.

I use it for connection to two ftp servers

The first server is working perfectly, but when i use the same programm to connect to another one the "The underlying connection was closed: The server committed a protocol violation." exception is thrown when I call GetResponse method.

I found only one difference between servers.

The first server returns:

  • 220 Hello k-net ftp server

The second FTP return the same banner but ON RUSSIAN Lang!!!

  • 220 ! !

Is any UseUnsafeHeaderParsing property exists for FTPWebRequest, like for HTTP

P.S> I'am not using SSL!

The sources is here:

///...

FtpWebRequest listRequest =

(FtpWebRequest)WebRequest.Create(listUrl);

listRequest.UsePassive = false; //true

listRequest.Method = WebRequestMethods.Ftp.ListDirectory;

FtpWebResponse listResponse =

(FtpWebResponse)listRequest.GetResponse(); //WebException is HERE!!!

reader = new StreamReader(listResponse.GetResponseStream());

while (!reader.EndOfStream)

///...




Answer this question

FtpWebRequest GetResponse throw The server committed a protocol violation :(

  • get_rad

    Has a work around been identified and/or a problem fix provided

  • ebj

    Hi Mike,

    Any hopes of getting a fix anytime soon I am also having the problem.

    Thanks,

    marion


  • AbelMorelos

    I'll dig into this tomorrow - thanks for the follow up post.

  • JustJFe

    Spasibo :)



  • teone

    Is the server reachable from the internet so we can try to repro the issue   If not, can you provide a trace of the issue   Instructions for how to collect a trace are availalbe here: http://blogs.msdn.com/dgorti/archive/2005/09/18/471003.aspx   

  • t2nolan

    OK. I configure the extarnal ftp to the same configuration as my and exception still there!

    URL with login/pass:

    ftp://throw:throw@devgroup.mephist.ru

    The server banner message contains russian symbols.

    FTPWebRequest is dead :(

     



  • j1rider

    I am having trouble connecting to a remote FTP server.

    I am getting the error (The remote server returned an error: (530) Not logged in.).

    But I can connect to this FTP server from the IE using the same credentials.

    Any help would be appreciated.

    -Arul



  • Josh Kinder

    Give me 1 more day :)

  • jcman

    We have confirmed there is an error within FtpWebRequest.  Thank you for your feedback.  We will work to get this corrected.

  • Amaan

    Hello Mike,

    We are currently encountering exactly the same problem: FtpWebRequest GetResponse throws The server committed a protocol violation

    Because you have confirmed there is an error within FtpWebRequest I was wondering whether this problem has already been resolved and a new version of FtpWebRequest is available
    If not, is there some sort of workaround available

    Thanks a lot,
    Bas Pronk


  • Zurk

    Hi Mike

    Do you know of a fix for this error I am getting the same error (i.e. The underlying connection was closed: The server committed a protocol violation.) when connecting to a remote FTP server. here is a snippet from my error logs.


    ---------------------------------------------------------------------------------------
    7/6/2006 7:09:14 AM
    Source Exception: System - SyncRequestCallback
    Message: The underlying connection was closed: The server committed a protocol violation.
    Trace: at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
    at System.Net.FtpWebRequest.RequestCallback(Object obj)
    at System.Net.CommandStream.Abort(Exception e)
    at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
    at System.Net.FtpWebRequest.GetResponse()
    at MSS.FTP.FTPclient.GetStringResponse(FtpWebRequest pFTP)

    ---------------------------------------------------------------------------------------

    ---------------------------------------------------------------------------------------
    7/6/2006 7:09:14 AM
    Source Exception: FTP - ListDirectoryDetail
    Message: Object reference not set to an instance of an object.
    Trace: at MSS.FTP.FTPclient.ListDirectoryDetail(String pDirectory)

    Additional Info
    Error occoured while attempting a detailed directory listing of /DLD/NP1
    ---------------------------------------------------------------------------------------


  • daftest

    . Many thanks for your attention!

    Good luck!



  • Darren Parker - MSFT

    I connected last night, received the exception and took some logs/traces.  I'll post our findings once we get a minute to dig through the traces.

  • Darren Stones

    Hello!

    One question...

    Is the problem already resolved

    Can I change the banner of FTP back to English ;)

     



  • FtpWebRequest GetResponse throw The server committed a protocol violation :(