FTP not supported through http proxy

D

deostroll

I have got a web proxy through which I am able to browse the internet.
However when I try to perform ftp uploads I get an
InvalidOperationException saying that FTP commands cannot be issued
over a HTTP proxy.


System.InvalidOperationException was unhandled
Message="The requested FTP command is not supported when using HTTP
proxy."
Source="System"
StackTrace:
at System.Net.FtpWebRequest.GetHttpWebRequest()
at System.Net.FtpWebRequest.GetRequestStream()
at rcvfileUploader.Program.Main(String[] args) in C:\Arun
\JobsUploader\rcvfileUploader\rcvfileUploader\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(Assembly assembly, String
[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
 
M

Mark Salsbery [MVP]

I thought FTP and HTTP are two entirely different protocols....how does one
relate to the other??

Mark
 
D

deostroll

I thought FTP and HTTP are two entirely different protocols....how does one
relate to the other??

Mark

--
Mark Salsbery
Microsoft MVP - Visual C++


I have got a web proxy through which I am able to browse the internet.
However when I try to perform ftp uploads I get an
InvalidOperationException saying that FTP commands cannot be issued
over a HTTP proxy.
System.InvalidOperationException was unhandled
 Message="The requested FTP command is not supported when using HTTP
proxy."
 Source="System"
 StackTrace:
      at System.Net.FtpWebRequest.GetHttpWebRequest()
      at System.Net.FtpWebRequest.GetRequestStream()
      at rcvfileUploader.Program.Main(String[] args) in C:\Arun
\JobsUploader\rcvfileUploader\rcvfileUploader\Program.cs:line 23
      at System.AppDomain._nExecuteAssembly(Assembly assembly, String
[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
      at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
      at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()

We usually connect to the internet through a proxy server, which is
why I get the problem I think.

--deostroll
 
M

monteithm

I have got a web proxy through which I am able to browse the internet.
However when I try to perform ftp uploads I get an
InvalidOperationException saying that FTP commands cannot be issued
over a HTTP proxy.

System.InvalidOperationException was unhandled
  Message="The requested FTP command is not supported when using HTTP
proxy."
  Source="System"
  StackTrace:
       at System.Net.FtpWebRequest.GetHttpWebRequest()
       at System.Net.FtpWebRequest.GetRequestStream()
       at rcvfileUploader.Program.Main(String[] args) in C:\Arun
\JobsUploader\rcvfileUploader\rcvfileUploader\Program.cs:line 23
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String
[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
       at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

Have you looked at the documentation for
FtpWebRequest.GetRequestStream? There is a list of commands that are
accepted, and anything else is listed as throwing the exception you
see.

http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.getrequeststream(VS.80).aspx
 
D

deostroll

I have got a web proxy through which I am able to browse the internet.
However when I try to perform ftp uploads I get an
InvalidOperationException saying that FTP commands cannot be issued
over a HTTP proxy.
System.InvalidOperationException was unhandled
  Message="The requested FTP command is not supported when using HTTP
proxy."
  Source="System"
  StackTrace:
       at System.Net.FtpWebRequest.GetHttpWebRequest()
       at System.Net.FtpWebRequest.GetRequestStream()
       at rcvfileUploader.Program.Main(String[] args) in C:\Arun
\JobsUploader\rcvfileUploader\rcvfileUploader\Program.cs:line 23
       at System.AppDomain._nExecuteAssembly(Assembly assembly,String
[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
       at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
       at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

Have you looked at the documentation for
FtpWebRequest.GetRequestStream?  There is a list of commands that are
accepted, and anything else is listed as throwing the exception you
see.

http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.getr...

Hi,
I guess I've found a solution. I found it discussed in the msdn
forums. You have something called a proxy as a property for an
FtpWebRequest. Just initialize it with an empty instance...

myFtpRequestObj.Proxy = new WebProxy();

--deostroll
 

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