Create / remove directory

Discussion in 'ASP .Net' started by =?Utf-8?B?U3VzaGlTZWFu?=, Oct 9, 2007.

  1. Hello. I have problem with create and then remove directory on my site.
    It works like this. My page
    1) create directory
    Directory.CreateDirectory(DirectoryPath);
    2) put some files
    3) Remove directory
    Directory.Delete(DirectoryPath, true);

    And I have problem here. For some strange reasons this directory because
    read only and locked. I can't even open this until reopen my visial studio.
    Why it happend? How I can create directory with full access and then remove
    it with all files and subfolders inside?
     
    =?Utf-8?B?U3VzaGlTZWFu?=, Oct 9, 2007
    #1
    1. Advertisements

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

    Patrice Guest

    Only when using VS.NET ? Also if the file is server by ASP.NET it is lokced
    by default for a short period of time. Soa ccessing the site from a web
    client could prevent deleting it immedately after.

    Not sure what you are doing with those directories/files but my personal
    preference would be to avoid this or perhaps to serve them direcdtly from an
    aspx page (in whihc case IIS won't lock them).

    Also double check of course that you are properly closing those file...

    --
    Patrice


    "SushiSean" <> a écrit dans le message de
    news: ...
    > Hello. I have problem with create and then remove directory on my site.
    > It works like this. My page
    > 1) create directory
    > Directory.CreateDirectory(DirectoryPath);
    > 2) put some files
    > 3) Remove directory
    > Directory.Delete(DirectoryPath, true);
    >
    > And I have problem here. For some strange reasons this directory because
    > read only and locked. I can't even open this until reopen my visial
    > studio.
    > Why it happend? How I can create directory with full access and then
    > remove
    > it with all files and subfolders inside?
     
    Patrice, Oct 9, 2007
    #2
    1. Advertisements

  3. Thanks, what about derectory security?
    I mean in function Directory.Create(DirName, Security)
    exist Security param. How set up this to make dir with full access?

    "Patrice" wrote:

    > Only when using VS.NET ? Also if the file is server by ASP.NET it is lokced
    > by default for a short period of time. Soa ccessing the site from a web
    > client could prevent deleting it immedately after.
    >
    > Not sure what you are doing with those directories/files but my personal
    > preference would be to avoid this or perhaps to serve them direcdtly from an
    > aspx page (in whihc case IIS won't lock them).
    >
    > Also double check of course that you are properly closing those file...
    >
    > --
    > Patrice
     
    =?Utf-8?B?U3VzaGlTZWFu?=, Oct 9, 2007
    #3
    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. Simon-Pierre  Jarry
    Replies:
    2
    Views:
    2,626
    Henrik
    Aug 10, 2005
  2. kbass
    Replies:
    2
    Views:
    2,136
    Graham Fawcett
    Nov 13, 2003
  3. Replies:
    0
    Views:
    336
  4. Replies:
    0
    Views:
    295
  5. tshad
    Replies:
    6
    Views:
    21,776
    tshad
    Aug 8, 2006
  6. SushiSean

    Remove directory problem

    SushiSean, Dec 13, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    432
    SushiSean
    Dec 15, 2007
  7. Replies:
    6
    Views:
    350
    John W. Krahn
    Sep 30, 2006
  8. Slickuser

    Can't remove directory

    Slickuser, Aug 25, 2008, in forum: Perl Misc
    Replies:
    9
    Views:
    309
    Tad J McClellan
    Aug 27, 2008
Loading...