soundy
soundy

Reputation: 307

Download Docx file from local server machine to client?

In c# I've assigned to write code for download and upload docx file from local server machine to the same local client machine. Let me explain clearly,

For example: If i need to send docx file (C:\sample.docx ) to client machine into directory(D:\sample) using web server(Here using apache tomcat) .. Here using httpwebrequest & httpwebresponse classes..

Is there any possible to find out the solution? Trying simple client - server application, It’s like a file sharing (Server assign word file to client and then client download that assigned file), I'm done with sockets-TCP/IP that’s works really fine. But trying to work out using http...

Upvotes: 0

Views: 1129

Answers (1)

Alexander Beletsky
Alexander Beletsky

Reputation: 19821

You cound not send something for Server to Client. Client have to request, Server have to respond.

This is a rather simple task. You can just place your file into web site folder (~/sites/mysite/simple.docx), if appache is configured and you requested http://mysite/simple.docx, file would be returned as response.

WebClient class DownloadFile method is very suitable for that.

Upvotes: 1

Related Questions