大家好,由于项目中需要一个FTP功能,具体上传下载倒是没什么问题,最大的问题是,FtpWebRequest只有一个create方法那里可以传递路径,导致如果我要更换一个文件夹的话,都要重新连接一次服务器,我相信微软没理由这么设计的,只是我没找到办法而已,请大家帮忙看看,怎样才能重复利用那个已经登录好的FtpWebRequest呢,不用重复登录。 
下载的代码: 
 FtpWebRequest reqFTP; 
try 

    FileStream outputStream = new FileStream(localPath, FileMode.Create); 
    reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + m_ftpServerUrl + "/" + remotePath)); 
    reqFTP.Method = WebRequestMethods.Ftp.DownloadFile; 
    reqFTP.UseBinary = true; 
    reqFTP.Credentials = new NetworkCredential(m_userName, m_password); 
    FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse(); 
    Stream ftpStream = response.GetResponseStream(); 
    long cl = response.ContentLength; 
    int bufferSize = 2048; 
    int readCount; 
    byte[] buffer = new byte[bufferSize]; 
    readCount = ftpStream.Read(buffer, 0, bufferSize); 
    while (readCount > 0)                { 
        outputStream.Write(buffer, 0, readCount); 
        readCount = ftpStream.Read(buffer, 0, bufferSize); 
    }     ftpStream.Close(); 
    outputStream.Close(); 
    response.Close(); 

catch (Exception ex) 

    MessageBox.Show(ex.Message); 
} 如上面的代码,如果我先是要下载"ftp://127.0.0.1/test/a.mp3"的,下载好后,要进入"ftp://127.0.0.1/download/a.mp3",那么又得执行一遍上面的代码,相当于重新去连接了一次服务器,那得多慢。我希望FtpWebRequest连接好以后,如果我没断开,应该可以重复用才对