G
Guest
Hi,
In a winform application (in C#) I am trying to write to a file with the following:
String filepath = @"C:\Documents and Settings\MyAccount\MyDirectory";
FileStream fsCurrentFile = new FileStream(filepath,FileMode.Append);
StreamWriter sw = new StreamWriter(fsCurrentFile);
But I get the following error message:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path "C:\Documents and Settings\MyAccount\MyDirectory" is denied.
I don't understand why I get that because I debug on an Administrator acount.
It is written that it may be because the Directory is read-only.
I checked the Directory, it was read-only; I removed the read-only but it comes back
by some magic I don't know about. All my directories seemed to be Read-Only, and I can't change that (when I
do the change, I comes back afterward!).
Any idea what I could do??
Thanks a million!
Jenny
PS: I just installed VS 2003, maybe it is related to that...
In a winform application (in C#) I am trying to write to a file with the following:
String filepath = @"C:\Documents and Settings\MyAccount\MyDirectory";
FileStream fsCurrentFile = new FileStream(filepath,FileMode.Append);
StreamWriter sw = new StreamWriter(fsCurrentFile);
But I get the following error message:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path "C:\Documents and Settings\MyAccount\MyDirectory" is denied.
I don't understand why I get that because I debug on an Administrator acount.
It is written that it may be because the Directory is read-only.
I checked the Directory, it was read-only; I removed the read-only but it comes back
by some magic I don't know about. All my directories seemed to be Read-Only, and I can't change that (when I
do the change, I comes back afterward!).
Any idea what I could do??
Thanks a million!
Jenny
PS: I just installed VS 2003, maybe it is related to that...