File copy onto remote server of different domain with credentials.
-
I'm trying to copy a file to a destination path (for example \newserver\destinationFolder), that can be in another domain or using a different username/password than the current user. How can I specify these new network credentials before doing the File.Copy(...) ? pls guide me a way to copy file onto remote server of different domain with credentials.. Thanks inadvance... .
No Defeat Is Final Until You Stop Trying!.......
-
I'm trying to copy a file to a destination path (for example \newserver\destinationFolder), that can be in another domain or using a different username/password than the current user. How can I specify these new network credentials before doing the File.Copy(...) ? pls guide me a way to copy file onto remote server of different domain with credentials.. Thanks inadvance... .
No Defeat Is Final Until You Stop Trying!.......
Take a look here A small C# Class for impersonating a User[^] Then do something similar to this:
using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
{
// code that executes under the new context.
File.Copy( x, y );
} -
Take a look here A small C# Class for impersonating a User[^] Then do something similar to this:
using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
{
// code that executes under the new context.
File.Copy( x, y );
}Thanks Mario for the reply.. But i want to achieve this in windows plotform not through web. i should be able to transfer files once i know remote server's username,password and domain.. pls help me in this regard
No Defeat Is Final Until You Stop Trying!.......
modified on Thursday, June 23, 2011 1:24 AM