WebException

R

repairman2003

I am getting the following error when trying to call
GetRequestStream(): System.Net.WebException: The requested URI is
invalid for this FTP command..

Code where the exception catches:

...
FtpWebRequest uploadRequest =
(FtpWebRequest)WebRequest.Create(uploadUrl);
uploadRequest.Method =
WebRequestMethods.Ftp.UploadFile;

// UploadFile is not supported through an Http proxy
// so we disable the proxy for this request.
uploadRequest.Proxy = null;

exception------> requestStream = uploadRequest.GetRequestStream();
fileStream = File.Open(fileName, FileMode.Open);
....

On my machine I set up a ftp server through IIS, allowed anonymous
connections and allowed read/write privileges. Anybody can shed some
light on this?
 
N

Nicholas Paldino [.NET/C# MVP]

Well, what is the url that you are passing to the request?
 
R

repairman2003

Well, what is the url that you are passing to the request?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




I am getting the following error when trying to call
GetRequestStream(): System.Net.WebException: The requested URI is
invalid for this FTP command..
Code where the exception catches:
...
FtpWebRequest uploadRequest =
(FtpWebRequest)WebRequest.Create(uploadUrl);
uploadRequest.Method =
WebRequestMethods.Ftp.UploadFile;
// UploadFile is not supported through an Http proxy
// so we disable the proxy for this request.
uploadRequest.Proxy = null;
exception------> requestStream = uploadRequest.GetRequestStream();
fileStream = File.Open(fileName, FileMode.Open);
....
On my machine I set up a ftp server through IIS, allowed anonymous
connections and allowed read/write privileges. Anybody can shed some
light on this?- Hide quoted text -

- Show quoted text -

I'm just accessing ftp://<myipaddress>/ it works fine if I open up
explorer and type in the address and create a file.
 
N

Nicholas Paldino [.NET/C# MVP]

Are you using PASV or no when going through explorer? Also, are you
setting binary to true/false depending on how you want to upload the file?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Well, what is the url that you are passing to the request?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




I am getting the following error when trying to call
GetRequestStream(): System.Net.WebException: The requested URI is
invalid for this FTP command..
Code where the exception catches:
...
FtpWebRequest uploadRequest =
(FtpWebRequest)WebRequest.Create(uploadUrl);
uploadRequest.Method =
WebRequestMethods.Ftp.UploadFile;
// UploadFile is not supported through an Http proxy
// so we disable the proxy for this request.
uploadRequest.Proxy = null;
exception------> requestStream = uploadRequest.GetRequestStream();
fileStream = File.Open(fileName, FileMode.Open);
....
On my machine I set up a ftp server through IIS, allowed anonymous
connections and allowed read/write privileges. Anybody can shed some
light on this?- Hide quoted text -

- Show quoted text -

I'm just accessing ftp://<myipaddress>/ it works fine if I open up
explorer and type in the address and create a file.
 
R

repairman2003

Are you using PASV or no when going through explorer? Also, are you
setting binary to true/false depending on how you want to upload the file?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Well, what is the url that you are passing to the request?
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I am getting the following error when trying to call
GetRequestStream(): System.Net.WebException: The requested URI is
invalid for this FTP command..
Code where the exception catches:
...
FtpWebRequest uploadRequest =
(FtpWebRequest)WebRequest.Create(uploadUrl);
uploadRequest.Method =
WebRequestMethods.Ftp.UploadFile;
// UploadFile is not supported through an Http proxy
// so we disable the proxy for this request.
uploadRequest.Proxy = null;
exception------> requestStream = uploadRequest.GetRequestStream();
fileStream = File.Open(fileName, FileMode.Open);
....
On my machine I set up a ftp server through IIS, allowed anonymous
connections and allowed read/write privileges. Anybody can shed some
light on this?- Hide quoted text -
- Show quoted text -
I'm just accessing ftp://<myipaddress>/ it works fine if I open up
explorer and type in the address and create a file.- Hide quoted text -

- Show quoted text -


I am not using PASV and I am not setting binary to true/false.
 
R

repairman2003

Found the problem. the URI needed to include the filename in it, not
just the address of the server. Thanks for you help though
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top