Retaining local file system access while impersonating to access a remote drive

D

Daniel

Is it possible to retain local file system read, write, delete access while
impersonating for access to a remote drive in a different domain? I need to
be able to move files from a local computer to a remote computer. do i have
to copy them from the local computer to the remote computer then delete them
fromt the local computer after undo-ing the impersonation? Or is there a way
to retain access to both the local computer and the remote computer by while
impersonating the use that has access to the remote computer? The File.Move
requires read and write access to both the filesystem of the source and the
destination because it deletes the file from the source when it is copied to
the destination. My current solution is to impersonate, copy local to
target, undo impersonation, delete locals. But i would like to be able to
impesonate, move local to target, undo impersonation.
 
N

Nicholas Paldino [.NET/C# MVP]

Daniel,

If you don't have full rights for a move in this manner, then you will
have to switch impersonation contexts. You can not have the rights merged
from two different users, as the current thread only runs in one user
context.

Hope this helps.
 
D

Daniel

ahh, but when i am impersonating the user that has access to the remote
drive, i can still create directories

Nicholas Paldino said:
Daniel,

If you don't have full rights for a move in this manner, then you will
have to switch impersonation contexts. You can not have the rights merged
from two different users, as the current thread only runs in one user
context.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Daniel said:
Is it possible to retain local file system read, write, delete access
while
impersonating for access to a remote drive in a different domain? I need
to
be able to move files from a local computer to a remote computer. do i
have
to copy them from the local computer to the remote computer then delete
them
fromt the local computer after undo-ing the impersonation? Or is there a
way
to retain access to both the local computer and the remote computer by
while
impersonating the use that has access to the remote computer? The
File.Move
requires read and write access to both the filesystem of the source and
the
destination because it deletes the file from the source when it is copied
to
the destination. My current solution is to impersonate, copy local to
target, undo impersonation, delete locals. But i would like to be able to
impesonate, move local to target, undo impersonation.
 
D

Daniel

and i can still create directories in the local file system and add files to
my created directory, it only chokes when i try to add/change files in the
existing directories

Nicholas Paldino said:
Daniel,

If you don't have full rights for a move in this manner, then you will
have to switch impersonation contexts. You can not have the rights merged
from two different users, as the current thread only runs in one user
context.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Daniel said:
Is it possible to retain local file system read, write, delete access
while
impersonating for access to a remote drive in a different domain? I need
to
be able to move files from a local computer to a remote computer. do i
have
to copy them from the local computer to the remote computer then delete
them
fromt the local computer after undo-ing the impersonation? Or is there a
way
to retain access to both the local computer and the remote computer by
while
impersonating the use that has access to the remote computer? The
File.Move
requires read and write access to both the filesystem of the source and
the
destination because it deletes the file from the source when it is copied
to
the destination. My current solution is to impersonate, copy local to
target, undo impersonation, delete locals. But i would like to be able to
impesonate, move local to target, undo impersonation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top