sftp from ASP.Net RRS feed

  • Question

  • User724628980 posted
    I am trying to sftp from an ASP.Net page.  I got as far as having it work from commandline:
    sftp -o IdentityFile=id_rsa -b test.bat me@mylocalhost

    where test.bat contains a put statement.  The process seems to run fine without throwing any errors, but I never see the file.  Can someone point me in the right direction?  This is roughly the code I have:
    System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("sftp.exe");
    psi.WorkingDirectory = directory; // some directory
    psi.Arguments = "-o IdentityFile=id_rsa -b test.bat me@mylocalhost";
    System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);

    Tuesday, August 23, 2005 5:32 PM

All replies

  • User-1853252149 posted
    Have you looked at the FTP log file for help?

    Wednesday, August 24, 2005 11:55 AM
  • User724628980 posted
    I looked in Event Viewer, but did not see any errors appear running my program.  I see a promising file under C:\Program Files\OpenSSH\var\log, but I can't read it in a text editor.  How can I read this file?

    So far, my solution has been to port out the code to an executable and then have a scheduled task run the executable and then the sftp commands in a bat file.  The scheduled task works fine, but it is running under my identity, and it can't be run on demand.  I thought perhaps that the problem was that ASPNET didn't have permissions to sftp into my account, so I granted permissions to to all the executables and bat I had and granted read/write access to my home directory.  Was there anything else I missed?
    Wednesday, August 24, 2005 12:56 PM
  • User-1853252149 posted
    The FTP log is configured in your FTP server setup.  Wherever it's located, that's where you read it from.  Plain text.

    Tuesday, August 30, 2005 3:51 PM