How to SFTP from ASP.NET??

G

Guest

Hi,

I need to sftp a file from my ASP.NET application to a unix server. I tried
to run the sftp2 from command line...
Process myprocess=new Process();
myprocess.StartInfo.FileName="sftp2";
myprocess.StartInfo.Arguments="-W <password file> -B <batch file>
<user>@<host_name>"
myprocess.StartInfo.WindoStyle=ProcessWindowStyle.Normal;
myprocess.Start();
myprocess.WaitForExit();
batch file contains..
cd <directory inwhich file to be put>
binary
put <filename>
quit

The error Iam getting is, when we try to create a handshake for the first
time, we need to give a yes which we are not able to do in this case and
hence the connect gets closed.

Can anyone throw some light on this??????
 
M

Markus

I need to sftp a file from my ASP.NET application to a unix server. I tried
to run the sftp2 from command line...
Process myprocess=new Process();
myprocess.StartInfo.FileName="sftp2";
myprocess.StartInfo.Arguments="-W <password file> -B <batch file>
<user>@<host_name>"
myprocess.StartInfo.WindoStyle=ProcessWindowStyle.Normal;
myprocess.Start();
myprocess.WaitForExit();
batch file contains..
cd <directory inwhich file to be put>
binary
put <filename>
quit

The error Iam getting is, when we try to create a handshake for the first
time, we need to give a yes which we are not able to do in this case and
hence the connect gets closed.

Can anyone throw some light on this??????

Just some lights, not a complete solution ;-).

- First you could check the configuration optins of sftp2. Perhaps there
is something with "ignore handshake check".

- Second there is a file with all the authenticated keys, at least what
is concerning ssh on linux (%USER%/.ssh/auth_keys). Normally, on
windows there is a similar file.
So if you know the public key of the server you wish to connect to,
you could check that file, if the key is contained, if not, add it
(before making any connections at all).
The file is normally quite simple to read/write, as every line is a
key, so that shouldn't be the challenge, but first you have to figure
out, where these settings are stored for your specific sftp2
application.

hth
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top