473,804 Members | 3,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FTPWebRequest Problem

If I create an MFC application in Visual Studio 6 using the following
code:

CInternetSessio n inet_session;
CFtpConnection *ftp_connection ;

ftp_connection = inet_session.Ge tFtpConnection( "Integration300 ",
"guest", "ihannah", 21,TRUE);

CString CurrentDirector y;
ftp_connection->GetCurrentDire ctory(CurrentDi rectory);

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.Crea te(@"ftp://integration300" );
request.Credent ials = new NetworkCredenti al("guest","iha nnah");
request.Proxy = null;
request.EnableS sl = false;
request.UseBina ry = true;
request.KeepAli ve = false;
request.Method =
WebRequestMetho ds.Ftp.ListDire ctoryDetails;

FtpWebResponse response = (FtpWebResponse )request.GetRes ponse();
response.Close( );

Does anyone have any idea why this is the case?

Regards

Ian Hannah

Sep 11 '06 #1
3 1981
FtpWebRequest request =
(FtpWebRequest) WebRequest.Crea te(@"ftp://integration300" );
request.Credent ials = new NetworkCredenti al("guest","iha nnah");
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.Crea te(@"ftp://integration300" );
request.Credent ials = new NetworkCredenti al("guest","iha nnah");

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.Soc ket)...

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
3572
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 host is on a Unix server. I'm using the FtpWebRequest and FtpWebResponse classes to do the file uploading. I have tested it without any errors at all uploading to an IIS FTP server hosted on our network Most of the time it uploads without error to...
0
9803
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 by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
5
7696
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 system, but the same is working fine in windows. For example, this is my uri to connect to the Sun Solaris server machine "ftp://ssriniva:ssriniva@apfsun/apfqa/users/ssriniva/apfhome/config" here the 'config' folder is not present in the...
9
3903
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 with an FTP site that I setup on IIS. However, I have an issue at the customer site. Their FTP server is on Linux, but I presume that is not an issue. What happened the first time I ran it was that it deleted every other file. It just so...
6
13694
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 use the Windows Explorer to go on the FTP-URI and this always works. So the problem should come from my app. my simplified code: Private m_oFTP As FtpWebRequest Private oResponseDir As FtpWebResponse = Nothing
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7622
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.