Permission denied creating directory

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=, Jun 21, 2004.

  1. Hi,

    I have a created a simple file upload asp.net web page which also creates directories on the fly using the following code:

    string fullpath = Server.MapPath(".\\..\\..\\" + path);
    DirectoryInfo dir = new DirectoryInfo(fullpath);
    if(!dir.Exists)
    dir.Create();

    Now the dir.Create() statement gives me a permission denied. The ASP.NET user has been giving full control to the directory and in IIS Admin the directory has write permissions for scripts set. There is no problem in uploading the file to an already created directory which I find extremely weird!

    What goes wrong ?

    My OS is Windows XP using .NET framework 1.1. All the latest security patches are installed.
    =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=, Jun 21, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=

    Scott Allen Guest

    Hi Christoffer:

    One way to trouble shoot these types of problems is to enable auditing
    and find out "who" is getting the access denied message.

    See:
    http://www.pluralsight.com/keith/book/html/howto_enableauditing.html
    and
    http://www.pluralsight.com/keith/book/html/howto_auditfileaccess.html

    Also, make sure the permissions apply to subfolders - click "Advanced"
    and check the "Apply To" column.

    HTH,

    --
    Scott
    http://www.OdeToCode.com

    On Mon, 21 Jun 2004 08:25:40 -0700, Christoffer Sørensen
    <> wrote:

    >Hi,
    >
    >I have a created a simple file upload asp.net web page which also creates directories on the fly using the following code:
    >
    >string fullpath = Server.MapPath(".\\..\\..\\" + path);
    >DirectoryInfo dir = new DirectoryInfo(fullpath);
    >if(!dir.Exists)
    > dir.Create();
    >
    >Now the dir.Create() statement gives me a permission denied. The ASP.NET user has been giving full control to the directory and in IIS Admin the directory has write permissions for scripts set. There is no problem in uploading the file to an already created directory which I find extremely weird!
    >
    >What goes wrong ?
    >
    >My OS is Windows XP using .NET framework 1.1. All the latest security patches are installed.
    Scott Allen, Jun 21, 2004
    #2
    1. Advertising

  3. "Scott Allen" wrote:

    > One way to trouble shoot these types of problems is to enable auditing
    > and find out "who" is getting the access denied message.
    > See:
    > http://www.pluralsight.com/keith/book/html/howto_enableauditing.html
    > and
    > http://www.pluralsight.com/keith/book/html/howto_auditfileaccess.html


    Thanks for these links.

    > Also, make sure the permissions apply to subfolders - click "Advanced"
    > and check the "Apply To" column.


    I have found what the problem was. The ASPNET user I added was from another domain. Now I have added the local ASPNET user and it works.

    The audit thing really helped. Thank you very much!

    Kind regards,

    Christoffer Sørensen
    =?Utf-8?B?Q2hyaXN0b2ZmZXIgU8O4cmVuc2Vu?=, Jun 22, 2004
    #3
    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. Ken Yee
    Replies:
    2
    Views:
    2,434
    Ken Yee
    Oct 7, 2005
  2. Light
    Replies:
    1
    Views:
    923
    Eliyahu Goldin
    Mar 22, 2006
  3. Ken Yee
    Replies:
    2
    Views:
    218
    Ken Yee
    Oct 7, 2005
  4. Tony Proctor
    Replies:
    9
    Views:
    169
    Tony Proctor
    Oct 20, 2007
  5. vivekian
    Replies:
    1
    Views:
    204
    Martijn Lievaart
    Aug 22, 2007
Loading...

Share This Page