Click here to Skip to main content
12,553,991 members (63,290 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows Application
Hi All,

How to save files in server folder using windows application with c#?

Thanks and Regards,
Posted 30-Dec-12 18:06pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


You can save any file to sever if the server path is shared.


WindowsIdentity identity = new WindowsIdentity(username, password);
WindowsImpersonationContext context = identity.Impersonate();
    File.Copy(@"c:\temp\File.txt", @"\\server Name or IP\folder\File.txt", true);
Member 10292068 4-Dec-15 5:03am
i have a confusion is the Username and password is of Server PC or local PC ?
Suvabrata Roy 4-Dec-15 8:07am
You are going to copy file from your local machine and paste it into server so you required server credentials which have access to that particular folder

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100