Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2003, 04:08 PM
Authorized User
 
Join Date: Jul 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default Downloading ZIP File from FTP Site

Hello everyone and thanks for your help in advance. I am working on an application that allows a user to downlad a zip file from an FTP site. I have used the following code:

Dim URL As String = "f= "ftp://ftpsite/data.zip"

Dim outputFile As String = "C:\Data.zip"
Dim wReq As WebRequest
Dim wResp As WebResponse
Dim respStream As Stream
Dim reader As StreamReader
Dim writer As StreamWriter

' create the Web Request
wReq = WebRequest.Create(URL)

' get the response
wResp = wReq.GetResponse()
respStream = wResp.GetResponseStream()
reader = New StreamReader(respStream, Encoding.ASCII)

' and write it to the required file
writer = New StreamWriter(outputFile)
writer.Write(reader.ReadToEnd())

However, the application fails to work. I have verified that the FTP site is configured properly and works, so the problem is in my code. I am not exactly sure what is wrong. Any help would be greatly appreciated. Thanks.

 
Old July 19th, 2003, 04:28 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Hugh,

I am not 100% sure, but shouldn't you send authentication credentials to the FTP server? AFAIK, even in an open FTP server, you would still need to send "Anonymous" or whatever as the user name. Maybe that's causing the problem.....

HtH

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 20th, 2003, 05:23 PM
Authorized User
 
Join Date: Jul 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

Actually, I am not sure where I would send it except in the URL. Does the WebRequest and WebResponse support FTP?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging into a site and downloading a file lokilewis ASP.NET 1.0 and 1.1 Basics 3 June 10th, 2007 09:59 AM
downloading wrox united.zip forry01 ASP.NET 1.0 and 1.1 Basics 2 October 27th, 2006 04:12 AM
problem downloading wrox united.zip file forry01 ASP.NET 2.0 Basics 0 October 26th, 2006 10:48 AM
Upload Of Excel file to FTP Site shahbazr4 Java Databases 0 May 2nd, 2005 04:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.