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. Is there a way to transfer files to remote computer of different domain using remote server's username and password??? (c# , console)

Is there a way to transfer files to remote computer of different domain using remote server's username and password??? (c# , console)

Scheduled Pinned Locked Moved C#
csharpsysadminquestion
15 Posts 4 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.
  • OriginalGriffO OriginalGriff

    Look at the FtpWebRequest Class[^]

    Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

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

    Thanks for the reply.. is there any other ways other than Ftpwebrequest.. pls help me.. i have tried 1) MAP drive 2) NET USE

    No Defeat Is Final Until You Stop Trying!.......

    OriginalGriffO 1 Reply Last reply
    0
    • S surender m

      Thanks for the reply.. is there any other ways other than Ftpwebrequest.. pls help me.. i have tried 1) MAP drive 2) NET USE

      No Defeat Is Final Until You Stop Trying!.......

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #4

      If you are looking for an off the shelf application, then I use FileZilla[^] - it's open source and works well. You can't use MAP drive (AFIAK) unless the computer has a fixed IP address and share name - I've never tried that either, but in theory it should work. NET USE will probably have the same problem.

      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        If you are looking for an off the shelf application, then I use FileZilla[^] - it's open source and works well. You can't use MAP drive (AFIAK) unless the computer has a fixed IP address and share name - I've never tried that either, but in theory it should work. NET USE will probably have the same problem.

        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

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

        Thanks for the reply sir, I want to achieve file transfer through c# console application by specifying remote system's domain,user name & password. can it be done so..? pls help me..

        No Defeat Is Final Until You Stop Trying!.......

        OriginalGriffO 1 Reply Last reply
        0
        • S surender m

          Thanks for the reply sir, I want to achieve file transfer through c# console application by specifying remote system's domain,user name & password. can it be done so..? pls help me..

          No Defeat Is Final Until You Stop Trying!.......

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #6

          The third example in the original link shows how to do that, I thought...

          Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          S 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            The third example in the original link shows how to do that, I thought...

            Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

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

            sir didn't get u.. third example ??

            No Defeat Is Final Until You Stop Trying!.......

            OriginalGriffO 1 Reply Last reply
            0
            • S surender m

              sir didn't get u.. third example ??

              No Defeat Is Final Until You Stop Trying!.......

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #8

              If you follow the first link I gave you, then scroll down. After the "Remarks" section there are three examples: Deleting, downloading, and then uploading a file from a remote site via FTPWebRequest. The example you want is the third of these, and is about 1/4 of the way down the whole page.

              Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              S 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                If you follow the first link I gave you, then scroll down. After the "Remarks" section there are three examples: Deleting, downloading, and then uploading a file from a remote site via FTPWebRequest. The example you want is the third of these, and is about 1/4 of the way down the whole page.

                Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

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

                sorry for the wrong communication. i will explain it clearly. Consider machinA and machineB. - A & B are located on different domains. - B is having a network share path(ex: \\192.168.10.12\d$) - Now i want to transfer a file abc.txt from machineA to share path on MachineB. I am trying with File.copy() method bt was failed with longon failure as the servers are located on different domains. So, is there a way that if i know MachineB logon account(domain,username&password) can i be able to transfer file?? pls guide me a way to achieve this.

                No Defeat Is Final Until You Stop Trying!.......

                P 1 Reply Last reply
                0
                • S surender m

                  sorry for the wrong communication. i will explain it clearly. Consider machinA and machineB. - A & B are located on different domains. - B is having a network share path(ex: \\192.168.10.12\d$) - Now i want to transfer a file abc.txt from machineA to share path on MachineB. I am trying with File.copy() method bt was failed with longon failure as the servers are located on different domains. So, is there a way that if i know MachineB logon account(domain,username&password) can i be able to transfer file?? pls guide me a way to achieve this.

                  No Defeat Is Final Until You Stop Trying!.......

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #10

                  You need to impersonate the account in order to access the other domain. Had you searched Google, you'd have found this[^] article which does exactly what you are trying to do.

                  Forgive your enemies - it messes with their heads

                  My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                  S 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    You need to impersonate the account in order to access the other domain. Had you searched Google, you'd have found this[^] article which does exactly what you are trying to do.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

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

                    Thanks for the reply sir, Yes i had gone through that Link earlier, but i was stuck at LongonUser() part. Will it accept localuser account or remote server's user account? which username,password&domain i should give?

                    No Defeat Is Final Until You Stop Trying!.......

                    P 1 Reply Last reply
                    0
                    • S surender m

                      Thanks for the reply sir, Yes i had gone through that Link earlier, but i was stuck at LongonUser() part. Will it accept localuser account or remote server's user account? which username,password&domain i should give?

                      No Defeat Is Final Until You Stop Trying!.......

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #12

                      You need to give it the remote account details - that's the user you are trying to impersonate. It's no use giving a local account. By the way, please don't cross post. I just found the same question posted in Q&A - if you post in multiple places, it's hard to see what advice you have been given, and the missing nugget of information can get lost because we haven't seen the other post.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                      S 1 Reply Last reply
                      0
                      • S surender m

                        Is there a way to transfer files to remote computer of different domain using remote server's username and password?(c#,console) Thanks inadvance

                        No Defeat Is Final Until You Stop Trying!.......

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

                        You are quite impatient guy. This is a double post! If you would be a bit more patient, later on I could give you an example!

                        S 1 Reply Last reply
                        0
                        • M Mario Majcica

                          You are quite impatient guy. This is a double post! If you would be a bit more patient, later on I could give you an example!

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

                          Sorry .. my apologies for the impatience..

                          No Defeat Is Final Until You Stop Trying!.......

                          1 Reply Last reply
                          0
                          • P Pete OHanlon

                            You need to give it the remote account details - that's the user you are trying to impersonate. It's no use giving a local account. By the way, please don't cross post. I just found the same question posted in Q&A - if you post in multiple places, it's hard to see what advice you have been given, and the missing nugget of information can get lost because we haven't seen the other post.

                            Forgive your enemies - it messes with their heads

                            My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

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

                            Sorry .. my apologies..

                            No Defeat Is Final Until You Stop Trying!.......

                            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