C#怎样在服务器端创建文件夹
1个回答
2017-01-01 · 知道合伙人互联网行家
关注
展开全部
//创建FTP文件夹
public Boolean FtpMakeDir(string localFile)//想要创建的文件夹
{
// _Uri是Uri类的路径
FtpWebRequest req = (FtpWebRequest)WebRequest.Create(_Uri + localFile);
req.Credentials = new NetworkCredential(UserName, Password);
req.Method = WebRequestMethods.Ftp.MakeDirectory;
try
{
FtpWebResponse response = (FtpWebResponse)req.GetResponse();
response.Close();
}
catch (Exception)
{
req.Abort();
return false;
}
req.Abort();
return true;
}
public Boolean FtpMakeDir(string localFile)//想要创建的文件夹
{
// _Uri是Uri类的路径
FtpWebRequest req = (FtpWebRequest)WebRequest.Create(_Uri + localFile);
req.Credentials = new NetworkCredential(UserName, Password);
req.Method = WebRequestMethods.Ftp.MakeDirectory;
try
{
FtpWebResponse response = (FtpWebResponse)req.GetResponse();
response.Close();
}
catch (Exception)
{
req.Abort();
return false;
}
req.Abort();
return true;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询