Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Log.Info("Retrieving DC DMV Response File");
- string source = @"216.12.134.169";
- string destination = @"/users/BMICI/BOB_Outbound/";
- string host = "216.12.134.169";
- string username = "BMICI";
- string password = "Pwd_Bmici35";
- int port = 21; //Port 22 is defaulted for SFTP upload
- try
- {
- using (SftpClient client = new SftpClient(host, port, username, password))
- {
- client.Connect();
- client.ChangeDirectory(destination);
- using (FileStream fs = new FileStream(source, FileMode.Open))
- {
- client.BufferSize = 4 * 1024;
- client.UploadFile(fs, Path.GetFileName(source));
- }
- }
- //using (var conn = new SftpClient(ConfigurationManager.AppSettings["DCDMVServer"],
- // Convert.ToInt32(ConfigurationManager.AppSettings["DCDMVPort"], CultureInfo.InvariantCulture),
- // ConfigurationManager.AppSettings["DCDMVUsername"],
- // ConfigurationManager.AppSettings["DCDMVPassword"]))
- //{
- // conn.Connect();
- // Log.Info("Downloading DC DMV return files from DC MVA");
- // foreach (var file in conn.ListDirectory("users/BMICI/BOB_Outbound"))
- // {
- // if (file.IsDirectory)
- // {
- // continue;
- // }
- // var downloadPath = Path.Combine(ConfigurationManager.AppSettings["DMVFilesFromPoint"],
- // "DCMVA Returns", file.Name);
- // using (var fs = File.OpenWrite(downloadPath))
- // {
- // Log.DebugFormat("Downloading {0} to {1}", file.FullName, downloadPath);
- // conn.DownloadFile(file.FullName, fs);
- // }
- // file.Delete();
- // }
- //}
- }
- catch (Exception ex)
- {
- Log.Error("DC DMV Reponse File Download error", ex);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement