I am trying to download a selected FTP file from an FTP site in ASP.Net and VB.Net.

Earlier I was having problems that the box wasnt registering my selection being made, but now it is.

However, when I go to download the file I get an error message that says:

'The requested URI is invalid for this FTP command.'

It is pointing to the following code:

Dim ftpResponse As FtpWebResponse = ftp.GetResponse()

I have set up the FTP Request as thus:

Dim ftp As FtpWebRequest = DirectCast(FtpWebRequest.Create("ftp://xx.xx.x.xx/In/"), FtpWebRequest)

Is it saying that the URL for the ftp site I am providing is incorrect?

Or does this mean something else?

Thanks in advance.

Dan

Hi crishlay,

Thank you, but I can upload files.

I want to download a file.

Thanks,

Dan

Check you have permision on FTP to download the file.

Hi Pgmer,

Ok then I will do that now.

In the meantime, if I am selecting a value from a checkboxlist, what would I say when providing a path of where to save the file?

Would I do: "C:\" & CheckBoxList1.SelectedItem.Text?

Or would it be something else?

What I am asking, is, what would the type be of the file being stored in the CheckBoxList?

Many Thanks,

Dan

What is checklist box here? what is the item it hold? Can you please explain ?
your working in ASP.NET web page? or windows application?

Hi Pgmer,

I am produing a site in Visual Studio 2010.

I am scripting in VB.Net and ASP.Net.

Basically, when a user logs in to the system, they click on a page and it loads up with a CheckBoxList that gets the FTP directory details - so displays a list of all files currently on the FTP site.

I am trying to do it so that I click a file and click download.

At the moment, I get an error saying that the URI is invalid for the FTP command which is this:

Dim ftpResponse As FtpWebResponse = CType(ftp.GetResponse(), FtpWebResponse)

I dont know what to do.

Thanks,

Dan

So your checlist item will give you the source where the file is and u need to provide the path where you want source file to be downloaded...

Yes basically, I am a bit confused by it and am after a bit of advice on how to accomplish this.

Thanks,

Dan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.