Solved

C#.NET FTP Request Error

Posted on 2008-10-21
6
700 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 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

21 Experts available now in Live!

Get 1:1 Help Now