asp.net-mvcftpsftp

is it posible to upload directly to remote server using SFTP on ASP.net MVC


I am currently developing something using asp.net MVC.

I have a form for user to upload Video. The current ideal concept to upload to remote server is to Upload it to to the current server, then use FTP to push it to a remote server.

For me, this is not quite fast since you have to upload to current server (Time x1) and then the current server push to new server (Time x2) so it's double the time.

So my idea is to make user upload it to the current server, and WHILE user is uploading, the current server add the file to DB and also send the file to the remote server at the same time using SFTP...

Is it possible and are there any security hole in this concept?


Solution

  • I'd recommend using the NULL Ftp Server for your testing. If you connect to it using Filezilla client you'll notice that it prompts the user to accept the ssl key. It does that in the same way that putty.exe or any SSH client does.

    So, you code just needs to accept the SSL connection and then from that point forward it is just regular FTP commands.

    Programmatically, I dont know how to accept the cert and so all I can suggest is that you set up a batch file to run the Putty sftp client and push files and then have your code call the batch file. I'm pretty sure ASP supports calling a batch file.