cannot write file to network drive



I have a program that uses the filoInfo.Replace method to overwrite a file
with a newly created file, creating a backup of the original file. I tested
this on my local drive successfully, but when using it on a network drive I
get the following error. I checked the file permissions and everyone seems
to have read/write and I am able to write files to the directory directly.
I'm using the current logged on user to perform the function. If somebody
could help me I would appreciate it greatly! Thanks.

Error:

The process failed: System.Security.SecurityException: Request for the
permissio
n of type 'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0
..0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMa
rk& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.File.Delete(String path)
at FileEdit.EditFiles.Directories.GetFiles(DirectoryInfo di)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
Request for the permission of type
'System.Security.Permissions.FileIOPermission
, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' f
ailed.
Directory: WI The number of files is: 42
The process failed: System.Security.SecurityException: Request for the
permissio
n of type 'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0
..0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMa
rk& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access,
FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encodin
g, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.CreateText(String path)
at FileEdit.EditFiles.Directories.GetFiles(DirectoryInfo di)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
Request for the permission of type
'System.Security.Permissions.FileIOPermission
, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' f
ailed.

--
Karen
.



Relevant Pages