Files become ReadOnly

From: Miro (anonymous_at_discussions.microsoft.com)
Date: 05/17/04


Date: Mon, 17 May 2004 04:06:02 -0700

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 Temp
  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-folder

Thanks
Miro



Relevant Pages

  • Copy and delete files on W2003 Server - ReadOnly problem
    ... 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 CopyDWGFileToTemp() ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Incoming Messages Disappearing
    ... > downloads the messages and correctly terminating the session. ... > messages to a temp folder (via webmail), though OE still does not display the ... > We then thought maybe a corrupted dbx file in OE may be causing this. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Incoming Messages Disappearing
    ... downloads the messages and correctly terminating the session. ... messages to a temp folder (via webmail), though OE still does not display the ... We then thought maybe a corrupted dbx file in OE may be causing this. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Received mail cannot move to another folder...especailly HOTMAIL
    ... into my own folder, which named "TEMP FOLDER". ... "Send/Receive", Some mails can, but some are not.. ... private void inbox_Items_ItemAdd ... Microsoft.Office.Interop.Outlook.MailItem mailItem = ...
    (microsoft.public.outlook.program_addins)