FtpWebRequest Connecting to an AS/400

前端 未结 4 1569
一整个雨季
一整个雨季 2021-01-25 04:01

I need to download some files via ftp from an old AS/400 server. My code looks more or less like:

FtpWebRequest _request = (FtpWebRequest)WebRequest.Create(\"ft         


        
相关标签:
4条回答
  • 2021-01-25 04:38

    I've had this message often in the past, and it meant that I forgot to change the name format.

    There are two name formats possible when doing FTP with an AS400, and it can be changed with the FTP command NAMEFMT:

    0 is for the library system files (library\filename.member)

    1 is for the files in the IFS, where a CSV file would be

    By default, it is set to 0.

    Change it to 1 and it should work. However I'm not sure how it can be changed with a FtpWebRequest.

    0 讨论(0)
  • 2021-01-25 04:40

    To make life a little bit easier, the FTP server decides what NameFormat you want to use, based on your first command. If you start with "cd /home", then the FTP server does automatically set NAMEFMT to 1 for you.

    Indeed, you can change this manually during your session with the remote FTP command NAMEFMT. Please, notice that you don't need the (old) iSeries way. You can address EVERY object on the iSeries with NAMEFMT 1. For example, "get /QSYS.LIB/MYLIBRARY.LIB/MYFILE.FILE/MYMEMBER.MBR" will do the trick for any iSeries database table. Even for multimember files!

    0 讨论(0)
  • 2021-01-25 04:49

    This is an aggregate answer from the ones previously provided, but I was able to get this working by using the following structure:

    ftp://[HostName]/%2F/[directory]/[subdirectory]/[filename].csv

    The '%2F' was required and serves as a separator between the host name and the path.

    0 讨论(0)
  • 2021-01-25 04:59

    According to this page, fwd slash is the path separator character:

    The forward slash is the separator character for paths sent to the FTP server.

    A similar conversation over at Microsoft's forums (2005 era) indicates it's a bug in FtpWebRequest:

    Currently FtpWebRequest does not support quote and I cannot think of a way you'll be able to overide the method without exposing our code Mariya Atanasova [NCL]MSFT, Moderator, Nov 2005

    Try updating to the most recent versions or try a different library; the MS forum thread has several.

    0 讨论(0)
提交回复
热议问题