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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Moving a file from one server to another

Moving a file from one server to another

Scheduled Pinned Locked Moved C#
csharpasp-netsysadminhelpquestion
2 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.
  • C Offline
    C Offline
    chubbysilk
    wrote on last edited by
    #1

    Hello, I am trying to implement an asp.net page which will move a file from a folder on the web server to another server. I have the following code: File.Move("E:\temp\image.gif", "\\dnssvr1\Ad\image.gif"); When I try this, I am getting some sort of error about a username and password. Is there a particular place where I have to set a username and password? Do I need to specify the path to the destination differently? Thanks, RC

    H 1 Reply Last reply
    0
    • C chubbysilk

      Hello, I am trying to implement an asp.net page which will move a file from a folder on the web server to another server. I have the following code: File.Move("E:\temp\image.gif", "\\dnssvr1\Ad\image.gif"); When I try this, I am getting some sort of error about a username and password. Is there a particular place where I have to set a username and password? Do I need to specify the path to the destination differently? Thanks, RC

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      This means you (or whatever credentials the app is running under) don't have permissions to the remote resource. Either make sure your domain account has appropriate permissions to that directory (or, in some cases, that a local user with exactly the same username and password exists on both machines - such as on a workgroup), or use impersonation for someone that does. See WindowsIdentity for easy impersonation in .NET.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      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