ftp站点的配置问题,高分求救!!!!!!!!!!!!!
我机器是xp系统,iis是5.0版本.我想给默认的ftp站点分配一个用户,用该用户连接ftp站点(代码如下)
private void Download(string filePath, string fileName)
{
FtpWebRequest reqFTP;
string ftpServerIP = "192.1.0.1";
string ftpUserID = "yutao_lu";
string ftpPassword = "131421";
try
{
FileStream outputStream = new FileStream(filePath + "\\" + fileName, FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + fileName));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
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站点的用户名:ftpUserID和密码: ftpPassword
请问我要怎么配置ftp默认的站点才能得到呢?
本人在线等,会的哥们指教下,具体点,本人在线等,问题解决马上给分!
------解决方案--------------------修改这里。 可以写个WEBGONFIG中读取也可以传参数。方法很多啦
string ftpServerIP = "192.1.0.1";
string ftpUserID = "yutao_lu";
string ftpPassword = "131421";
http://www.54it.com.cn