Directory.CreateDirectory() throwing DirectoryNotFound exception for //server/share path

Discussion in 'ASP .Net Web Services' started by Dan, Jul 23, 2004.

  1. Dan

    Dan Guest

    Hello,

    I am creating an ASP.NET web service with VB, and I need to be able to
    create a directory on a network share. When I attempt to create the
    directory (\\server\share\test), I receive the DirectoryNotFound
    exception, stating "Could not find part of the path '\\server\share'."
    I have also found that when I create the "test" folder in that
    network share, and run Directory.Exists("\\server\share\test"), it
    returns false.

    All of the code works fine when dealing with local paths (such as
    "C:\test"). I have verified that the account the web service is
    running as has all the necessary permissions.

    Any ideas?

    Here is the actual code that throws the exception: (strFilePath =
    "\\server\share\test")

    If Not Directory.Exists(strFilePath) Then
    Directory.CreateDirectory(strFilePath)
    ....

    Thank you!
     
    Dan, Jul 23, 2004
    #1
    1. Advertisements

  2. Dan

    Max Guest

    What are the security permissions of \\server\share and of the underlying
    directory on the server?
    What permission does your code have?
    Does it use Internet Guest Account (IUSR_<ComputerName>)?


    "Dan" <> wrote in message
    news:...
    > Hello,
    >
    > I am creating an ASP.NET web service with VB, and I need to be able to
    > create a directory on a network share. When I attempt to create the
    > directory (\\server\share\test), I receive the DirectoryNotFound
    > exception, stating "Could not find part of the path '\\server\share'."
    > I have also found that when I create the "test" folder in that
    > network share, and run Directory.Exists("\\server\share\test"), it
    > returns false.
    >
    > All of the code works fine when dealing with local paths (such as
    > "C:\test"). I have verified that the account the web service is
    > running as has all the necessary permissions.
    >
    > Any ideas?
    >
    > Here is the actual code that throws the exception: (strFilePath =
    > "\\server\share\test")
    >
    > If Not Directory.Exists(strFilePath) Then
    > Directory.CreateDirectory(strFilePath)
    > ...
    >
    > Thank you!
     
    Max, Jul 26, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GM
    Replies:
    2
    Views:
    2,485
  2. Eran Kampf
    Replies:
    7
    Views:
    6,412
    Eran Kampf
    Oct 13, 2004
  3. =?Utf-8?B?Q2xpbnRvbiBGcmFua2xhbmQ=?=

    CreateDirectory() - Could not find a part of the path "D:\".

    =?Utf-8?B?Q2xpbnRvbiBGcmFua2xhbmQ=?=, Apr 5, 2005, in forum: ASP .Net
    Replies:
    9
    Views:
    10,085
    john_crim
    Jun 6, 2005
  4. Andrew R. Jones
    Replies:
    2
    Views:
    3,766
    Andrew R. Jones
    Jan 5, 2006
  5. Chad
    Replies:
    6
    Views:
    3,048
  6. Matt MacDonald
    Replies:
    0
    Views:
    506
    Matt MacDonald
    Jan 30, 2008
  7. Wayne Brantley

    Directory.CreateDirectory always fails.

    Wayne Brantley, Jul 11, 2005, in forum: ASP .Net Security
    Replies:
    8
    Views:
    513
    [MSFT]
    Aug 3, 2005
  8. Saraswati lakki
    Replies:
    0
    Views:
    1,684
    Saraswati lakki
    Jan 6, 2012
Loading...