Exemplo n.º 1
0
        private static string SaveUrlToLocalPdfviaFtp(string url, string server, int port, string name, string pwd)
        {
            FTPClient ftpClient = new FTPClient();

            ftpClient.FTPLogin(server, port, name, pwd);
            if (!Directory.Exists(_tempLocation))
            {
                Directory.CreateDirectory(_tempLocation);
            }
            string urlLink = Uri.UnescapeDataString(url);

            urlLink = urlLink.Substring(urlLink.LastIndexOf('/') + 1);
            var fileName = Path.Combine(_tempLocation, urlLink);

            ftpClient.DownLoadFile(fileName, url);

            return(fileName);
        }