views:

301

answers:

0

im getting this error "Cannot handle redirect from http/https protocols to other dissimilar ones" any help please ?

this is a part of my code, i try with and without proxy, when without proxy it says that i need one and when i set the proxy (in app.config or by code says the error i said).

reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(_server + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
base.BlockNumber = "103";
reqFTP.Credentials = new NetworkCredential(_userID, _password);
base.BlockNumber = "104";
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
base.BlockNumber = "105";
Stream ftpStream = response.GetResponseStream();
base.BlockNumber = "106";
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
base.BlockNumber = "107";
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
  outputStream.Write(buffer, 0, readCount);
  readCount = ftpStream.Read(buffer, 0, bufferSize);
}
base.BlockNumber = "108";
ftpStream.Close();
ftpStream.Dispose();
ftpStream = null;
response.Close();
response = null;