473,473 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how use FtpWebRequest class to access different directory ?

hi everyone

I have a quick question when i use the FtpWebRequest.

What I need to do is that:
Connect a FTP server,check whether there is a folder
if not,create it, then changed the path to the new folder
If use the command line to do that,it just use the "CD" command
can finish.But there is not the command in WebRequestMethods.Ftp

how could do that?if i want to change the directory when i has been
login?

Thanks
Kevin Lee

Nov 7 '06 #1
3 9701
Hi Kevin,

Try setting the "Method" property to "CD".

Please let us know if that works for you.

--
Dave Sexton

"Kevien Lee" <ir************@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
hi everyone

I have a quick question when i use the FtpWebRequest.

What I need to do is that:
Connect a FTP server,check whether there is a folder
if not,create it, then changed the path to the new folder
If use the command line to do that,it just use the "CD" command
can finish.But there is not the command in WebRequestMethods.Ftp

how could do that?if i want to change the directory when i has been
login?

Thanks
Kevin Lee

Nov 7 '06 #2
Hi Kevin,

"The Method property determines which command is sent to the server. You set
the Method by using the strings defined in the public field members of the
WebRequestMethods.Ftp class. Note that the strings defined in the
WebRequestMethods.Ftp class are the only supported options for the Method
property. Setting the Method property to any other value will result in an
ArgumentException exception."

"FtpWebRequest.Method property"
http://msdn2.microsoft.com/en-us/lib...od(VS.80).aspx

Sorry, but I don't think it can be done using FtpWebRequest. You'd have to
reconnect by calling the Create method again. I guess FtpWebRequest is really
just meant to encapsulate a single request, not an entire session.

You should look into some of the other FTP components available for .NET such
as those mentioned here:

[watch for wrapping]
http://groups.google.com/group/micro...edef59acfd86c1

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
Hi Kevin,

Try setting the "Method" property to "CD".

Please let us know if that works for you.

--
Dave Sexton

"Kevien Lee" <ir************@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
>hi everyone

I have a quick question when i use the FtpWebRequest.

What I need to do is that:
Connect a FTP server,check whether there is a folder
if not,create it, then changed the path to the new folder
If use the command line to do that,it just use the "CD" command
can finish.But there is not the command in WebRequestMethods.Ftp

how could do that?if i want to change the directory when i has been
login?

Thanks
Kevin Lee


Nov 7 '06 #3
Dave Sexton:
Thanks very much.

The FtpWebRequest is too simple :(

Dave Sexton wrote:
Hi Kevin,

"The Method property determines which command is sent to the server. You set
the Method by using the strings defined in the public field members of the
WebRequestMethods.Ftp class. Note that the strings defined in the
WebRequestMethods.Ftp class are the only supported options for the Method
property. Setting the Method property to any other value will result in an
ArgumentException exception."

"FtpWebRequest.Method property"
http://msdn2.microsoft.com/en-us/lib...od(VS.80).aspx

Sorry, but I don't think it can be done using FtpWebRequest. You'd have to
reconnect by calling the Create method again. I guess FtpWebRequest is really
just meant to encapsulate a single request, not an entire session.

You should look into some of the other FTP components available for .NET such
as those mentioned here:

[watch for wrapping]
http://groups.google.com/group/micro...edef59acfd86c1

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:OU**************@TK2MSFTNGP03.phx.gbl...
Hi Kevin,

Try setting the "Method" property to "CD".

Please let us know if that works for you.

--
Dave Sexton

"Kevien Lee" <ir************@gmail.comwrote in message
news:11**********************@f16g2000cwb.googlegr oups.com...
hi everyone

I have a quick question when i use the FtpWebRequest.

What I need to do is that:
Connect a FTP server,check whether there is a folder
if not,create it, then changed the path to the new folder
If use the command line to do that,it just use the "CD" command
can finish.But there is not the command in WebRequestMethods.Ftp

how could do that?if i want to change the directory when i has been
login?

Thanks
Kevin Lee
Nov 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP...
7
by: jose.lopes.cruz | last post by:
I need to access a FTP Server. I'm using FTPWebRequest as described in visual studio 2005 documentation. Everything works fine except the following: 1) I dont know how to change de current...
0
by: Alexis | last post by:
Hello, I am trying to upload a file to an ftp server using the FtpWebRequest class, but I get the following error. The requested URI is invalid for this FTP command. I do can upload the file...
2
by: Ian Hannah | last post by:
If I create an MFC application in Visual Studio 6 using the following code: CInternetSession inet_session; CFtpConnection *ftp_connection; ftp_connection = inet_session.GetFtpConnection(...
0
by: Bob Phillips | last post by:
Hello All: I've seen some strange behavior with the .net FtpWebRequest component. static void Main(string args) { Console.WriteLine("Connecting to server to list directory..."); Uri uri =...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
6
by: William LaMartin | last post by:
Could someone show me how to use the FtpWebRequest and change to a different directory? Changing directories is not listed as one of the methods, but I believe it can be done--just can't figure...
5
by: Sendil kumar | last post by:
Hi All, The FtpWebRequest.GetResponse( ) method is not giving "550 File not found exception " when I do a directory list operation on a invalid(not present) directory in HP Unix and Sun Solaris...
9
by: Waldy | last post by:
Hi there, I have written a service in VS2005 that downloads files from an FTP site processes them and then deletes the files if successfully processed. It all works fine when run in our test lab...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.