Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, October 14, 2015 2:30 PM
I currently have a winform utility which allows users to push files to a server for permanent storage in their particular project. (Not a programming project)
The utility utility supports users who use a computer which they have an Active Directory Domain account as well as some systems which are only in a workgroup.
The tool copies the files into a share (maintaining the files relative path) and notes the related project after which server sorts the files into their specific project folder.
I am not allowed to give the share fullaccess permission to everyone for the file copies and directory creation(to maintain paths).
The work around for this has been to create an account on the server for the utility where the utilty will attempt to map the share with its credentials. oNetDrive.MapNetworkDrive(TransferArea, freeDriveLeter, UserID. UserPassord);
Then perform the file copy of all selected files after which it will disconnect the share.
ShellFileOperation.DoFileOperation(sourcefile, DestinationFile,"Archiving Files", FileOp.Copy, FileOpFlags.NoCopySecurityAttributes | FileOpFlags.NoErrorUI, DirectoryInfo)
This is a bit clumsy. Is there a way to forgo actually mapping a drive? To copy the files directly to the share with the utilities credentials?
Thanks,
Mike
All replies (1)
Thursday, October 15, 2015 8:48 AM âś…Answered
Hi Mike,
>>I am not allowed to give the share fullaccess permission to everyone for the file copies and directory creation(to maintain paths).
You can use impersonation to switch between security contexts within the same process.
http://www.codeproject.com/Articles/10090/A-small-C-Class-for-impersonating-a-User
Please also refer to thread copy files with authentication in c#
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.