Last post Apr 04, 2014 05:05 AM by PatriceSc
Apr 03, 2014 03:19 AM|Phani1987|LINK
Hi. I have a scenario where my .net application generates some files which we are
transferring to unix server with ftp protocol. But now I want to replace the FTP
protocol with HTTPS without using any SFTP or WINSCP.
Can anyone suggest a way to move ahead as we are unable to find any solution for this.
Apr 03, 2014 05:04 AM|PatriceSc|LINK
Basically what I can think of would be either using
http://en.wikipedia.org/wiki/WebDAV or have a file upload page on the Unix server and use something such as
http://msdn.microsoft.com/en-us/library/36s52zhs(v=vs.110).aspx (basically it does the same than if someone uses a page with an input type=file HTML control...
Apr 03, 2014 05:20 AM|damienBod|LINK
Here is a way of doing it
This example uses the MultipartFormDataStreamProvider class. If you are copying large files, this example is not suitable.
You just need to define a URL on the Unix server then. (\\UnixPCNam\FileShare)
Apr 03, 2014 06:07 AM|Phani1987|LINK
For Webdav to be used it is not freeware and regarding the File Upload Page in Unix there should not be any manual intervention while transfering the files.
Apr 03, 2014 06:47 AM|damienBod|LINK
Do you have to use HTTPS? Is it not possible to set up a VPN?
Apr 03, 2014 07:57 AM|Phani1987|LINK
Yes. We have to use HTTPS only. Is there a way to achieve this?
Apr 03, 2014 01:40 PM|PatriceSc|LINK
You won't. The sample I pointed to :
- provide a server side page that you can use yourself to upload a file (here you would need a PHP or whatever technology is available on your Unix machine)
- OR if using WebClient.UploadFile it sends the same HTTP request to the same address (it just does programmatically from your code what a browser does when a user uploads a file)
The API sugestion is basically the same thing that is either you have something such as webdav and the https request you sent is handled directly by the web server or you have some code server side that handles the data you are sending to a particular url
(wether it handles API style or upload style HTTP requests).
Apr 04, 2014 03:02 AM|Phani1987|LINK
Hi PatriceSC. Thanks for the reply.
Here i want to clarify that we will host the application in Windows but we need to place the file to unix server with the hosted .Net application in windows.
Can i use this webclient.UploadFile in this case?
What do you mean by same address. Is it the application hosted location(i.e. Unix)? If so we cannot host any application in Unix. Unix Server is only for storing files.
We are already placing the files with .net Program using FTP. Now the requirement is to replace the FTP with HTTPS.
Apr 04, 2014 04:37 AM|PatriceSc|LINK
What I meant is that client side on a Windows machine you'll use WebCient.UploadFile. It takes a file and "POST" it using HTTP(S) to whatever web address you want. At this address you must have a page that will handle those incoming data (and it is done
in a manner that is very similar if not identical to what happens when a user post a file using an input type=file so usually you can even have a page that can be both used manually for testing and automatically by a program).
Basically this first approaach is just the same than the one you likely used tons of times to transfer a file to a web server from your own PC. Expect that here it will be done programmatically using WebClient.UploadFile rather than by your browser when
you hit the submit button.
Or you'll do an API call to a web address and then your server side will handle the incoming call.
Oh or could it be that they asked you to use https but yet this linux machine is NOT a web server ???
Apr 04, 2014 04:52 AM|Phani1987|LINK
Yes PatriceSC. The unix machine is not a web server. Windows machine is a web server.
We will deploy the application in Windows machine and this application needs to copy the file to Unix Machine using HTTPS.
Unix server will not have anything. This is just used for storing of files.
Apr 04, 2014 05:05 AM|PatriceSc|LINK
So it's as if you wanted to use FTP to upload files without this machine being a FTP server. HTTPS is for web servers so if this machine is not a web server it won't be able to respond to HTTPS requests.
More likely the guy who asked you to use HTTPS and the person in charge of this Linux machine needs to talk together to see what this machine should be able to do. For now, my understanding is that this machine is just a FTP server so you can use FTP. Period.
Ah or do you mean that the disk of this machine is directly available from your Windows web server as a network share ? Then you'll just save the file to
\\linux\folder\thisfile.txt exactly as if it were a Windows machine.