Code Slinger
Code Slinger

Reputation: 1130

FTPWebRequest & AS/400 - Setting NAMEFMT to 1

I'm trying to connect to a FTP AS/400 server using .NET, with a url like this:

ftp://server.com/folder/file.csv

I'm getting a 501 error in return, and according to this question it's due to the path separator or AS/400 not working with regular paths without setting NAMEFMT to 1.

Since I'm using the FTPWebRequest object, is there any way I can set NAMEFMT to 1 with a FTPWebRequest?

Upvotes: 2

Views: 2112

Answers (1)

James Allman
James Allman

Reputation: 41188

You need to send SITE NAMEFMT 1 as a QUOTE command.

See this related question: How to send arbitrary ftp commands in C#. It doesn't appear to be possible using FTPWebRequest.

Take a look at libcurl.NET.


Alternatively if you can force FTPWebRequest to make the 'first' file or pathname parameter received in a subcommand start with a slash (/) or a tilde (~) character the system will automatically enforce NAMEFMT 1. See File systems and naming conventions under the FTP reference information topic in the IBM i information center.

Upvotes: 7

Related Questions