the dreaded File.Move over network problem...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cm9nZXJfMjc=?=

    the dreaded File.Move over network problem...

    hey, I've seen this problem many times over the net, and now I'm one of them.
    simple code really.

    File.Move(Remot eFolder, MoveImportedFil esTo);

    where
    RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
    and
    MoveImportedFil esTo = C:\wow.csv

    all I get is "Access to the path is denied." . I dont get it. I'm not only a
    local, but a network admin, and I specifically gave my user FULL CONTROL over
    the directory.

    I'm doing this in a windows service.

    any ideas what else I could be missing here?
  • Michael D. Ober

    #2
    Re: the dreaded File.Move over network problem...

    "roger_27" <roger27@discus sions.microsoft .comwrote in message
    news:303119B7-EFD3-4780-BFFE-292ECE1351A8@mi crosoft.com...
    hey, I've seen this problem many times over the net, and now I'm one of
    them.
    simple code really.
    >
    File.Move(Remot eFolder, MoveImportedFil esTo);
    >
    where
    RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
    and
    MoveImportedFil esTo = C:\wow.csv
    >
    all I get is "Access to the path is denied." . I dont get it. I'm not only
    a
    local, but a network admin, and I specifically gave my user FULL CONTROL
    over
    the directory.
    >
    I'm doing this in a windows service.
    >
    any ideas what else I could be missing here?
    >

    The key is that you're doing the file move in a service. By default,
    Windows runs services under the LocalSystem account, which doesn't have
    network access. You need to change the service account to an account that
    has network access.

    Mike Ober.


    Comment

    • =?Utf-8?B?cm9nZXJfMjc=?=

      #3
      Re: the dreaded File.Move over network problem...

      but that's the thing, I am a network administrator, and that folder has
      permissions for administrators to have full control

      "Michael D. Ober" wrote:
      "roger_27" <roger27@discus sions.microsoft .comwrote in message
      news:303119B7-EFD3-4780-BFFE-292ECE1351A8@mi crosoft.com...
      hey, I've seen this problem many times over the net, and now I'm one of
      them.
      simple code really.

      File.Move(Remot eFolder, MoveImportedFil esTo);

      where
      RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
      and
      MoveImportedFil esTo = C:\wow.csv

      all I get is "Access to the path is denied." . I dont get it. I'm not only
      a
      local, but a network admin, and I specifically gave my user FULL CONTROL
      over
      the directory.

      I'm doing this in a windows service.

      any ideas what else I could be missing here?
      >
      >
      The key is that you're doing the file move in a service. By default,
      Windows runs services under the LocalSystem account, which doesn't have
      network access. You need to change the service account to an account that
      has network access.
      >
      Mike Ober.
      >
      >
      >

      Comment

      • =?Utf-8?B?cm9nZXJfMjc=?=

        #4
        Re: the dreaded File.Move over network problem...

        problem fixed. here was the problem:

        the SOURCE filename had the path AND filename
        the DESTINATION had only the PATH. needed the filename too.

        When you try to write using the textwriter to a FOLDER (as opposed to a
        file) you get "The given path's format is not supported". but I guess in this
        exact same problem, but with File.Move, you get "Access is denied". I think
        that's a rather misleading error. add to that that the intellisense says for
        the destination parameter "The New Path of the file" rather than "The new
        path and name of the file" and you can see how such a minute error could
        happen.

        but whatever. it's fixed!

        "roger_27" wrote:
        but that's the thing, I am a network administrator, and that folder has
        permissions for administrators to have full control
        >
        "Michael D. Ober" wrote:
        >
        "roger_27" <roger27@discus sions.microsoft .comwrote in message
        news:303119B7-EFD3-4780-BFFE-292ECE1351A8@mi crosoft.com...
        hey, I've seen this problem many times over the net, and now I'm one of
        them.
        simple code really.
        >
        File.Move(Remot eFolder, MoveImportedFil esTo);
        >
        where
        RemoteFolder = \\192.168.1.99\ ftp2users\monda y\original1.csv
        and
        MoveImportedFil esTo = C:\wow.csv
        >
        all I get is "Access to the path is denied." . I dont get it. I'm not only
        a
        local, but a network admin, and I specifically gave my user FULL CONTROL
        over
        the directory.
        >
        I'm doing this in a windows service.
        >
        any ideas what else I could be missing here?
        >

        The key is that you're doing the file move in a service. By default,
        Windows runs services under the LocalSystem account, which doesn't have
        network access. You need to change the service account to an account that
        has network access.

        Mike Ober.

        Comment

        Working...