Sync Network Shares across domains RRS feed

  • Question

  • I'm trying to use the File System Provider to sync 2 directories across domains.  This works fine when sync'ing a network share to a local directory by using impersonation to connect to the share.  However, I don't see a way to sync from one share using one set of credentials to another share using another set of credentials.


    I know that separate threads can be running under different user contexts.  Is it possible to initiate a sync to 2 network shares in different domains?


    This code doesn't work:

    Code Snippet

    using (Impersonator impersonator = new Impersonator("user1", "domain1", "pwd"))


    using (FileSyncProvider localProvider = new FileSyncProvider(localReplicaID, monitorPath, scopeFilter, FileSyncOptions.None))


    using (Impersonator impersonator2 = new Impersonator("user2", "domain2", "pwd"))


    using (FileSyncProvider remoteProvider = new FileSyncProvider(remoteReplicaID, targetPath, scopeFilter, FileSyncOptions.None))


    SyncOrchestrator syncOrchestrator = new SyncOrchestrator();


    syncOrchestrator.LocalProvider = localProvider;

    syncOrchestrator.RemoteProvider = remoteProvider;

    syncOrchestrator.Direction = SyncDirectionOrder.Upload;









    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:06 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Wednesday, June 4, 2008 9:39 PM


  • I solved this by doing the sync in 2 parts.  Here is the scenario:


    Source directories & files are in Domain1 and the Target directory is in Domain2.

    1. Impersonate a user in Domain1.
    2. Execute Sync from the Source Directory in Domain1 to a local directory where the application is running.
    3. Impersonate a user in Domain2.
    4. Execute Sync from the local directory to the Target Directory in Domain2.

    This doesn't seem to be the most efficient method but works.  Does anyone have any other suggestions?


    Thursday, June 5, 2008 9:33 PM