Solved

C#.NET FTP Request Error

Posted on 2008-10-21
6
701 Views
Last Modified: 2012-05-11
I am running the following code:

//Set up the FTP connection
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(strFtpUri);
ftpRequest.Credentials = new NetworkCredential(strFtpLogin, strFtpPassword);

//Initiate the request and read the response
FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
Stream ftpResponseStream = ftpResponse.GetResponseStream();
StreamReader reader = new StreamReader(ftpResponseStream, System.Text.Encoding.UTF8);

This works fine on my client but when I run it on Windows Server 2008 I recieve an error @ line:
--  FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();

The error states "The Remote Name Could Not Be Resolved".  Any ideas?
0
Comment
Question by:CipherIS
  • 4
  • 2
6 Comments
 
LVL 1

Author Comment

by:CipherIS
ID: 22767702
I think the issues is Windows Server 2008 is not allowing connection to the FTP site.  Will check.
0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22768505
the following link gives a perfect coding sample fo ftp file upload and download
i am already using the code from this sample in my windows service on windows 2008 server
hope it helps
https://secure.codeproject.com/KB/IP/SimpleFTPDemo.aspx
0
 
LVL 1

Author Comment

by:CipherIS
ID: 22768704
Nope.  Still does not work.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:CipherIS
ID: 22768727
Nope.  Still does not work.  Works on the client but on Windows Server 2008 it is not working.  Any ideas?
FTP-Error.JPG
0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22770883
can you please share your code and the parameters you are passing to connect to the ftp website
the error says could not resolve ftp - to me it means that you are just passing ftp as the ftp site name and not the fully qualified name
more details will definitely help
0
 
LVL 1

Accepted Solution

by:
CipherIS earned 0 total points
ID: 22786222
It was the set up of the Windows 2008 server that prevented the FTP connection.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now