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


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?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cannot you just copy the file through an unc path of the destination machine?
raheelasadkhanAuthor Commented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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

raheelasadkhanAuthor Commented:

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.


raheelasadkhanAuthor Commented:
Sorry for the delay guys. Have accepted the solution that worked for me. Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.