Click here to Skip to main content
12,950,832 members (58,062 online)
Rate this:
Please Sign up or sign in to vote.
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
OriginalGriff 5,984
CHill60 3,460
Maciej Los 3,053
Jochen Arndt 1,975
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2017
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