Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. FTP Upload in SAP B1 -Time out Error

FTP Upload in SAP B1 -Time out Error

Scheduled Pinned Locked Moved Visual Studio
help
2 Posts 2 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajeev M Kartha
    wrote on last edited by
    #1

    Hello Friends, My task is to upload a CSV file into a specified FTP loacation.But the system is throwing time out message from a line of the code. Please help me out on this issue. Below is the code i use. public static string UploadFile(string ftpUrl, string userName, string password, string uploadFTPDirectory, string localFilePath) { string PureFileName = new FileInfo(localFilePath).Name; String uploadUrl = String.Format("{0}{1}/{2}", ftpUrl, uploadFTPDirectory, PureFileName); //String uploadUrl = String.Format("{0}{1}", ftpUrl, uploadFTPDirectory); FtpWebRequest ftpRequest = (FtpWebRequest)FtpWebRequest.Create(uploadUrl); ftpRequest.Proxy =null; ftpRequest.Method = WebRequestMethods.Ftp.UploadFile; ftpRequest.Credentials = new NetworkCredential(userName, password); ftpRequest.UseBinary = true; ftpRequest.UsePassive = false; try { byte[] fileData = File.ReadAllBytes(localFilePath); ftpRequest.ContentLength = fileData.Length; using (Stream fileStream = ftpRequest.GetRequestStream()) { fileStream.Write(fileData, 0, fileData.Length); fileStream.Close(); } using (FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse())----------'Sytem throws the Timed out Message here.' { return ftpResponse.StatusDescription; } } catch(WebException e) { string s = ((FtpWebResponse)e.Response).StatusDescription; return s; } }

    L 1 Reply Last reply
    0
    • R Rajeev M Kartha

      Hello Friends, My task is to upload a CSV file into a specified FTP loacation.But the system is throwing time out message from a line of the code. Please help me out on this issue. Below is the code i use. public static string UploadFile(string ftpUrl, string userName, string password, string uploadFTPDirectory, string localFilePath) { string PureFileName = new FileInfo(localFilePath).Name; String uploadUrl = String.Format("{0}{1}/{2}", ftpUrl, uploadFTPDirectory, PureFileName); //String uploadUrl = String.Format("{0}{1}", ftpUrl, uploadFTPDirectory); FtpWebRequest ftpRequest = (FtpWebRequest)FtpWebRequest.Create(uploadUrl); ftpRequest.Proxy =null; ftpRequest.Method = WebRequestMethods.Ftp.UploadFile; ftpRequest.Credentials = new NetworkCredential(userName, password); ftpRequest.UseBinary = true; ftpRequest.UsePassive = false; try { byte[] fileData = File.ReadAllBytes(localFilePath); ftpRequest.ContentLength = fileData.Length; using (Stream fileStream = ftpRequest.GetRequestStream()) { fileStream.Write(fileData, 0, fileData.Length); fileStream.Close(); } using (FtpWebResponse ftpResponse = (FtpWebResponse)ftpRequest.GetResponse())----------'Sytem throws the Timed out Message here.' { return ftpResponse.StatusDescription; } } catch(WebException e) { string s = ((FtpWebResponse)e.Response).StatusDescription; return s; } }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please do not post the same question in multiple forums. This is not a Visual Studio issue.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups