473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

FTPWebRequest Problem

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( "Integration300",
"guest", "ihannah", 21,TRUE);

CString CurrentDirectory;
ftp_connection->GetCurrentDirectory(CurrentDirectory);

then the FTP connection is made and works as expected.

If I then try and use the following code (C#, Visual Studio 2005) I
always get a timeout:

// Get the object used to communicate with the server.
FtpWebRequest request =
(FtpWebRequest)WebRequest.Create(@"ftp://integration300");
request.Credentials = new NetworkCredential("guest","ihannah");
request.Proxy = null;
request.EnableSsl = false;
request.UseBinary = true;
request.KeepAlive = false;
request.Method =
WebRequestMethods.Ftp.ListDirectoryDetails;

FtpWebResponse response = (FtpWebResponse)request.GetResponse();
response.Close();

Does anyone have any idea why this is the case?

Regards

Ian Hannah

Sep 11 '06 #1
3 1959
FtpWebRequest request =
(FtpWebRequest)WebRequest.Create(@"ftp://integration300");
request.Credentials = new NetworkCredential("guest","ihannah");
Ensure that the assembly has sufficient permissions.
Request for Web-Request (Connect/Socket) permissions.

Check System.Security namespace.
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://articles.edujinionline.com/webservices
-------------------
Sep 12 '06 #2

Gaurav,

If security was the issue I would expect to get a security exception.
The exception that I am getting is a WebException "The Response has
time out".

Ian

Gaurav Vaish (www.EduJiniOnline.com) wrote:
FtpWebRequest request =
(FtpWebRequest)WebRequest.Create(@"ftp://integration300");
request.Credentials = new NetworkCredential("guest","ihannah");

Ensure that the assembly has sufficient permissions.
Request for Web-Request (Connect/Socket) permissions.

Check System.Security namespace.
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://articles.edujinionline.com/webservices
-------------------
Sep 13 '06 #3
If security was the issue I would expect to get a security exception.
The exception that I am getting is a WebException "The Response has
time out".
I'm assuming that you are testing from the same machine (MFC and .Net code)
;)

Not quite sure... but you may want to try out by first opening a simple
socket to the server. (System.Net.Socket)...

Otherwise, things are crazy to me right now... :D
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://www.edujinionline.com
http://articles.edujinionline.com/webservices
-------------------
Sep 13 '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...
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...
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...
6
by: Patrick.Simons | last post by:
I try to connect a FTPWebRequest through Proxy and VPN to a remote FTP- server. Sometimes it works sometimes not. When my VB.Net-App (2005) returns the error on the GetResponse-Method, I'll try to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.