bool CreateDirectoryStandardFtp(IActivityIOPath dst)
{
FtpWebResponse response = null;
try
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ConvertSslToPlain(dst.Path));
request.Method = WebRequestMethods.Ftp.MakeDirectory;
request.UseBinary = true;
request.KeepAlive = false;
request.EnableSsl = EnableSsl(dst);
if(dst.Username != string.Empty)
{
request.Credentials = new NetworkCredential(dst.Username, dst.Password);
}
if(dst.IsNotCertVerifiable)
{
ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertifications;
}
using(response = (FtpWebResponse)request.GetResponse())
{
if(response.StatusCode != FtpStatusCode.PathnameCreated)
{
throw new Exception("Fail");
}
}
}
catch(Exception ex)
{
Dev2Logger.Log.Error(this, ex);
}
finally
{
if(response != null)
{
response.Close();
}
}
return true;
}