Retrieving data from a ftp server

Posted on 2008-10-24
Medium Priority
Last Modified: 2013-12-24
I have made an asp.net website for a company. This company has bought a ftp server, which can be called with ftp://1234.12 ... and is password protectet.

Now they don't want to put the data which should be accessable  /downloadable from their website, (for example .pdf oder .zip files, etc.) on their webserver but on their company's ftp server.  For example the user clicks on xxx.pdf- the xxx.pdf should be replaced on their ftp server and be retrived from there on the website!

I have no idea if this is possible at all?  And if yes, how the link could look like? for example <a herf="ftp://111.11.11/xxx.pdf>

Thanks for a convincing answer.

Question by:Shareece
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
LVL 14

Expert Comment

by:Hedley Phillips
ID: 22794796
Use the following format:

<HREF="ftp://ftp.uwm.edu/pub/">UWM FTP pub</A>
LVL 14

Expert Comment

by:Hedley Phillips
ID: 22794821
Sorry, try this:

<a href="ftp://ftpserver.domain.com/dir1/dir2/test.pdf">link to ftp server here</a>
<a href="ftp://ftpserver.domain.com/dir1/dir2/test.pdf">link to ftp server here</a>

Open in new window

LVL 14

Expert Comment

by:Hedley Phillips
ID: 22794826
This was tested and working on our web server connecting to our FTP server just now.  All I have done is masked the real URL.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 20

Accepted Solution

edster9999 earned 1000 total points
ID: 22794829
The example above would put you into the directory so you could browse for the files although it should really be :
<a href="">FTP site</a>
or the example you gave yourself
<a herf="">Document on xxx</a>
would allow you to download an individual file.  (I added a missing quote and the name and the end </a>

One place this falls down is if the ftp site is password protected.
the two examples will both try to login with
user = anonymous and password of email address (probably default to some string by the browser like user@firefox.com)

You can specify the username and password in the link like this :
<a herf="ftp://username:secretpassword@">Document on xxx</a>
But that is not exactly secure is it as you are putting the password in plain text in the web page.

A better way would be to have the files in the http area and then these can be controlled by access lists and passwords etc.


Author Comment

ID: 22795285
Hello and thanks,
I still don't have the possibility to test, but I think
 <a herf="ftp://username:secretpassword@">Document on xxx</a>
could be a possilbe solution, by the time now I have to make some suggetions. Though some questions due to the last sentence:

>A better way would be to have the files in the http area
Do all  ftp-servers have a http:// area?

>these can be controlled by access lists and passwords etc.
This is fully ununderstandable for me, may you please explain a little bit more about it?
Thanks a lot

LVL 20

Expert Comment

ID: 22795336
No.   FTP servers are FTP servers.  
HTTP servers are web servers.

They can share the same files and can even act as each other but I mean you need to use the http server to do more fancy file sharing with passwords.  The FTP server is then not doing anything.
LVL 14

Assisted Solution

by:Hedley Phillips
Hedley Phillips earned 1000 total points
ID: 22795346
If your server is for internal users only and you are happy to have the username and password embedded in the html then the solution posted by edster9999: is fine.

If on the other hand you want people to enter the username and password into a prompt box then just use the ftp link and miss out the user details.

Only web servers have an http area, Edster was suggesting you lock specfic directories down on the web server and using access lists and .htaccess, set it up so that users have to enter a username and password to gain access. Which would be my preferred way of doing it.

Have a read of:
LVL 20

Expert Comment

ID: 22795416
I disagree.  Most browsers (including IE and firefox) will present 'anonymous' as the username and not pop up a login box.
LVL 14

Expert Comment

by:Hedley Phillips
ID: 22795504

Had me worried there, so I double checked..

My IE (version 7) does show a prompt box, but Firefox (version 3) doesn't. So, not really good enough for use in the real world as it looks shoddy.

So, really it all depends on whether the OP is happy to have login info in the link. I wouldn't unless it was on a LAN, and would use .htaccess (as you sufggest) instead esp as it is so easily configured in Apache.

Maybe the OP also needs to question the reason why the company doesn't want the files on the web server?


Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
This article is written by John Gates, CISSP. Gates, the SNUG President-Elect, currently holds the position of Manager of Information Systems at Lake Park High School in Roselle, Illinois.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Where to go on the main page to find the job listings. How to apply to a job that you are interested in from the list that is featured on our Careers page.
Suggested Courses

770 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