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 Error - Please Help

File.Copy Error - Please Help

Scheduled Pinned Locked Moved C#
helpquestion
7 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.
  • J Offline
    J Offline
    Joshua Lunsford
    wrote on last edited by
    #1

    The Error: Could not find file "\\myserver\share$\myfile.txt". The Code: File.Copy(@"\\myserver\share$\myfile.txt",@"c:\myfile.txt"), true); The file is there. The premissions on the share$ is set to everyone. I can navigate to the file using the above quoted string. What am I missing?

    J M R 3 Replies Last reply
    0
    • J Joshua Lunsford

      The Error: Could not find file "\\myserver\share$\myfile.txt". The Code: File.Copy(@"\\myserver\share$\myfile.txt",@"c:\myfile.txt"), true); The file is there. The premissions on the share$ is set to everyone. I can navigate to the file using the above quoted string. What am I missing?

      J Offline
      J Offline
      Joshua Lunsford
      wrote on last edited by
      #2

      :((:((

      1 Reply Last reply
      0
      • J Joshua Lunsford

        The Error: Could not find file "\\myserver\share$\myfile.txt". The Code: File.Copy(@"\\myserver\share$\myfile.txt",@"c:\myfile.txt"), true); The file is there. The premissions on the share$ is set to everyone. I can navigate to the file using the above quoted string. What am I missing?

        M Offline
        M Offline
        mav northwind
        wrote on last edited by
        #3

        Hi! I guess the problem lies in the share itself. If you enter "\\myserver\share$" in the address bar of a windows explorer, do you get a dialog asking for a user name and password? If you can see the file in your explorer, does the program still throw the exception afterwards? Or is the code executed from within a windows service process running under LocalSystem account? mav

        J 1 Reply Last reply
        0
        • M mav northwind

          Hi! I guess the problem lies in the share itself. If you enter "\\myserver\share$" in the address bar of a windows explorer, do you get a dialog asking for a user name and password? If you can see the file in your explorer, does the program still throw the exception afterwards? Or is the code executed from within a windows service process running under LocalSystem account? mav

          J Offline
          J Offline
          Joshua Lunsford
          wrote on last edited by
          #4

          thank you for responding... no.. no dialog box appears. Any lowly person in the company and open this share no problem. And the code is being executed by ASPNET account

          J 1 Reply Last reply
          0
          • J Joshua Lunsford

            thank you for responding... no.. no dialog box appears. Any lowly person in the company and open this share no problem. And the code is being executed by ASPNET account

            J Offline
            J Offline
            Joshua Lunsford
            wrote on last edited by
            #5

            i think i've boiled down the issue. ASPNET service account is a local service account to my machine. I'm trying to copy a file from a domain server. The premissions on the server is set to everyone, but that means everyone in the Domain, not local mcahin accounts. Now I need to figure out how to pass premissions with my file.copy... any clues?

            D 1 Reply Last reply
            0
            • J Joshua Lunsford

              i think i've boiled down the issue. ASPNET service account is a local service account to my machine. I'm trying to copy a file from a domain server. The premissions on the server is set to everyone, but that means everyone in the Domain, not local mcahin accounts. Now I need to figure out how to pass premissions with my file.copy... any clues?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              You don't. You can create a domain account, restrict it's log to certain machines!, that the ASP.NET server can run under. It doesn't have to run under a local machine account! Then you can give that domain account appropriate rights to the machines and folders required to run your code and do file copies. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              1 Reply Last reply
              0
              • J Joshua Lunsford

                The Error: Could not find file "\\myserver\share$\myfile.txt". The Code: File.Copy(@"\\myserver\share$\myfile.txt",@"c:\myfile.txt"), true); The file is there. The premissions on the share$ is set to everyone. I can navigate to the file using the above quoted string. What am I missing?

                R Offline
                R Offline
                RobertoTjMx
                wrote on last edited by
                #7

                Maybe the parameter are incorrect you can try with the ip: File.Copy(@"\###.###.###.###\directory\file.txt",@"c:\file.txt",true); I can use the instruction like my example and work well.

                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