Professional Web Applications Themes

Files become ReadOnly - ASP.NET Security

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, ...

  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. #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

Similar Threads

  1. Readonly Field
    By vortexweb in forum Macromedia Dynamic HTML
    Replies: 1
    Last Post: November 20th, 12:10 PM
  2. Readonly listbox
    By Johno in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 12th, 03:49 PM
  3. Collection Readonly
    By Greg -- in forum ASP.NET Web Services
    Replies: 3
    Last Post: July 31st, 12:04 PM
  4. Files not showing readonly or checked out
    By tshad in forum Dreamweaver AppDev
    Replies: 0
    Last Post: May 10th, 03:08 AM
  5. Making Files Readonly With a script
    By Alan Connor in forum Linux Setup, Configuration & Administration
    Replies: 1
    Last Post: August 27th, 06:57 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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