Link to home
Start Free TrialLog in
Avatar of raheelasadkhan
raheelasadkhanFlag for Pakistan

asked on

Need to quietly upload a file to a Web Server from a WinForms application

Hello,

I have a WinForms application (C#), that lets the user browse files on thier hard drive. The selected files need to be uploaded to a Web Server (IIS). I do not have tooption of using FTP since the permissions are not available. I assume your responses would include doing it through an intermediate Web Page. If so, I need to do this quietly in the background.

Any ideas?

Thanks,

Khan
Avatar of vo1d
vo1d
Flag of Germany image

cannot you just copy the file through an unc path of the destination machine?
Avatar of raheelasadkhan

ASKER

No. My application will be distributed to anonymous users who will not have the rights to copy files to the Web Server. This needs to be done in a secure manner.
ASKER CERTIFIED SOLUTION
Avatar of vo1d
vo1d
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pgloor
pgloor

Read this, if implementing a Web Service is an option:

http://www.codeproject.com/soap/MTOMWebServices.asp

Peter
Hi,

I like the following approach:
   System.Net.WebClient webClient = new System.Net.WebClient();
   byte [] data = webClient.UploadFile(address, method, fileName);

I do not, however, know how to implement it.
 - How do I point to a specific sub-directory where the file should be saved?
 - Do I need to grant special permissions on the target directory on the web server?
 - I want some king of an authentication mechanism so no one else can upload files the same way.

Thanks,

Khan
Sorry for the delay guys. Have accepted the solution that worked for me. Thanks