c# - Copy File Edge Case -
i have app running under userx. have 2 network paths point subfolder of same share, like:
- p1 =
\\mymainshare\share\folder 1 - p2 =
\\mymainshare\share\folder 2
userx has no permission on both p1 , p2 (which means cant read or write there), have userp1 , userp2. userp1 can read/write p1 only. userp2 can read/write p2 only.
now how can copy file 1 folder other?
so far insisted on file.copy , sorts of impersonation no positive results... "access denied"...
details:
- files being copied can reach 20gb
- the network path may point "\localhost\c$"
- this "server-side" app, means hundreds of requests handled each second... reading files memory, switching credentials, writing has been considered last resort due obvious scaling issues...
with specified constraints not have many options.
1 possibly better option "read memory / switch credentials / write" following:
read file (say share 1 userp1) in chunks while writing third, perhaps local, location both userp1 , userp2 has access to. read file location userp2 , write share 2.
if have ability in multi-threaded fashion have userp2 start reading file userp1 writing it. way not have finish waiting on writing third location finish before starting copying share 2. incur penalty of storage needed third location, neither memory penalty of reading whole file memory, nor time penalty of first copying entire file third location before starting write share 2.
Comments
Post a Comment