Files become ReadOnly

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Files become ReadOnly

    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[i])


    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 Guest

  2. Similar Questions and Discussions

    1. Readonly listbox
      I'm developing a set of WebControls that can be toggled between Readwrite and Readonly modes. They are each inherited from their standard webcontrol...
    2. Files not showing readonly or checked out
      I connected to my remote folder on my web server and synchronized the local view with the remote view. this worked fine. The problem is that the...
    3. ANNOUNCE: Readonly 1.03
      ANNOUNCEMENT Readonly.pm, v1.03 has been uploaded to PAUSE, and should be available at a CPAN near you Real Soon Now. DESCRIPTION Readonly.pm...
    4. Making Files Readonly With a script
      On Tue, 26 Aug 2003 21:50:02 +0100, JRH <john.nntp@yoredale2003.uklinux.net> wrote: For the cron.daily script, make sure you use full paths for...
    5. Readonly Checkbox?
      Well, I'm sure you guys know that the ASP.NET Checkbox control doesn't have a Readonly property. I'm writing an application where I need it to...
  3. #2

    Default RE: Files become ReadOnly

    It sounds like you need to declare the FileMode for the file(s) using the FileMode attribute.
    David Coe, MCP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139