FtpWebRequest returns HTML, not text
I'm trying to get a directory listing from an FTP account through a proxy.
Currently I get the correct results, but wrapped in an HTML page.
I could off course start filtering the information out of the response, but I think there should be a cleaner way.
When searching for a decent sollution, all I found were classes going back to socket level, usually not considering proxy authentication.
public List getLS() {
List result = null;
if (Connect()){
WebResponse response = null;
result = new List();
reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
reqFTP.UsePassive = true;
reqFTP.Proxy = new WebProxy("internet:80");
reqFTP.Proxy.Credentials = new NetworkCredential(username, password);
response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
while (!reader.EndOfStream)
{
result.Add(reader.ReadLine());
}
}
else {
throw new Exception("Could not connect to remote server");
}
return result;
}