Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. File copy onto remote server of different domain with credentials.

File copy onto remote server of different domain with credentials.

Scheduled Pinned Locked Moved C#
sysadmintutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    surender m
    wrote on last edited by
    #1

    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!.......

    M 1 Reply Last reply
    0
    • S surender m

      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!.......

      M Offline
      M Offline
      Mario Majcica
      wrote on last edited by
      #2

      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 );
      }

      S 1 Reply Last reply
      0
      • M Mario Majcica

        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 );
        }

        S Offline
        S Offline
        surender m
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups