Directory creation

Discussion in 'ASP .Net' started by Sparky, Jul 22, 2003.

  1. Sparky

    Sparky Guest

    I want to create a directory on my web server from within code. I've tried
    using Request.PhysicalApplicationPath() to get the location of the
    application, and appended my new directory on the end and used
    Directory.CreateDirectory which fails with:

    System.IO.DirectoryNotFoundException: Could not find a part of the path
    "d:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at
    System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at
    System.IO.Directory.CreateDirectory(String path) at ...

    BUT if I manually create the directory in an FTP program, and use
    Directory.Exists, it manages to find the directory... the problem just
    appears to be creating.

    Any clues?

    Cheers

    Sparky
    Sparky, Jul 22, 2003
    #1
    1. Advertising

  2. It's probably a security issue. By default ASP.NET runs under the ASPNET
    user account. This account does not have a lot of permissions on your
    machine. Simply grant it full read, write & create permissions to the path
    you're specifying on your server.

    --
    I hope this helps,
    Steve C. Orr, MCSD
    http://Steve.Orr.net


    "Sparky" <> wrote in message
    news:...
    > I want to create a directory on my web server from within code. I've tried
    > using Request.PhysicalApplicationPath() to get the location of the
    > application, and appended my new directory on the end and used
    > Directory.CreateDirectory which fails with:
    >
    > System.IO.DirectoryNotFoundException: Could not find a part of the path
    > "d:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at
    > System.IO.Directory.InternalCreateDirectory(String fullPath, String path)

    at
    > System.IO.Directory.CreateDirectory(String path) at ...
    >
    > BUT if I manually create the directory in an FTP program, and use
    > Directory.Exists, it manages to find the directory... the problem just
    > appears to be creating.
    >
    > Any clues?
    >
    > Cheers
    >
    > Sparky
    >
    >
    Steve C. Orr, MCSD, Jul 22, 2003
    #2
    1. Advertising

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. Mark F
    Replies:
    7
    Views:
    437
    Roedy Green
    Jul 28, 2004
  2. Rohan De Sa

    mfc / c++ directory creation problem

    Rohan De Sa, Sep 23, 2003, in forum: C Programming
    Replies:
    2
    Views:
    438
    Bruno Desthuilliers
    Sep 23, 2003
  3. Michael J Whitmore

    Newbie - Directory/File Creation

    Michael J Whitmore, Jul 8, 2003, in forum: Python
    Replies:
    1
    Views:
    294
    holger krekel
    Jul 8, 2003
  4. srinivasan srinivas

    Directory creation

    srinivasan srinivas, Sep 4, 2008, in forum: Python
    Replies:
    0
    Views:
    278
    srinivasan srinivas
    Sep 4, 2008
  5. Nello
    Replies:
    0
    Views:
    2,287
    Nello
    Apr 26, 2011
Loading...

Share This Page