C#.NET FTP Request Error

Posted on 2008-10-21
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?
Question by:CipherIS
  • 4
  • 2

Author Comment

ID: 22767702
I think the issues is Windows Server 2008 is not allowing connection to the FTP site.  Will check.
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

Author Comment

ID: 22768704
Nope.  Still does not work.
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.


Author Comment

ID: 22768727
Nope.  Still does not work.  Works on the client but on Windows Server 2008 it is not working.  Any ideas?
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

Accepted Solution

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

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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