我正在为文件下载做编码但是WebRequestMethods不存在显示..
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://something.com/temp.exe");
request.Method = WebRequestMethods.Ftp.DownloadFile;
request.Credentials = new NetworkCredential("admin", "1234");
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Stream responseStream = response.GetResponseStream();
FileStream file = File.Create(@"c:\temp\temp.exe");
byte[] buffer = new byte[32 * 1024];
int read;
//reader.Read(
while ((read = responseStream.Read(buffer, 0, buffer.Length)) > 0)
{
file.Write(buffer, 0, read);
}
file.Close();
responseStream.Close();
response.Close();
以上是我的代码,请指导我。!
答案 0 :(得分:0)
请考虑引用System
程序集并在代码中添加System.Mail
命名空间。
修改强>: - .NET Compact框架不支持System.Net.Mail或System.Web.Mail。你应该寻找扩展。