Files become ReadOnly

Discussion in 'ASP .Net Security' started by Miro, May 17, 2004.

  1. Miro

    Miro Guest

    Hello

    For some strange reasons, some of my files become ReadOnly when I copy them to a subfolder to my ASP.NET application. For each new session I clear the temp folder using this code

    private void ClearTempFolder(

    //Remove all dwg-files from Tem
    String[] dwgFiles = Directory.GetFiles(Server.MapPath(TempPath), "*.dwg")
    for (int i=0; i<dwgFiles.Length; i++
    File.Delete(dwgFiles)


    then the user makes selections on the page and new drawings are copied to the temp folder

    private void CopyDWGFileToTemp(

    ..
    if (File.Exists(frompath)

    File.Copy(frompath, Server.MapPath(topath), true)

    ..


    Sometimes the ClearTempFolder() function fails with an "Access denied" error. If there are for example four files in the folder, two of them are deleted and the two remaining are ReadOnly, and probably causing the error. Sometimes all files are deleted without problem. This problem seems to occur on Windows 2003 Server only. Any ideas on this one

    develop machine: Win XP, Framework 1.1, IIS 5.1, VS.NET 2003 (C#)
    Settings: Anonymous Access (IUSR account) and Windows Authentication are checked in IIS. IUSR has full rights on the Temp-folde

    Thanks
    Miro
    Miro, May 17, 2004
    #1
    1. Advertising

  2. It sounds like you need to declare the FileMode for the file(s) using the FileMode attribute.
    David Coe, MCP, May 18, 2004
    #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. =?Utf-8?B?UmFlZCBTYXdhbGhh?=

    ReadOnly XML Files

    =?Utf-8?B?UmFlZCBTYXdhbGhh?=, Nov 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    724
    =?Utf-8?B?U3JlZWppdGggUmFt?=
    Nov 7, 2005
  2. chad kline

    fastest way to load NON-readonly files.

    chad kline, Aug 12, 2003, in forum: C Programming
    Replies:
    0
    Views:
    295
    chad kline
    Aug 12, 2003
  3. chad kline

    fast way to read NON-readonly files

    chad kline, Aug 12, 2003, in forum: C Programming
    Replies:
    1
    Views:
    312
    Thomas Matthews
    Aug 12, 2003
  4. BillE

    can aspx files become corrupted?

    BillE, Apr 12, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    348
    Cowboy \(Gregory A. Beamer\)
    Apr 12, 2007
  5. Jonathan Hyatt
    Replies:
    1
    Views:
    1,912
    Jonathan Hyatt
    Jun 8, 2004
Loading...

Share This Page