ok i found !
there are a bug in Directory.Delet e if you use recursive mode.
when you delete a directory recursively, re create it, and reinstall the
new file, you obtain this error :
Exception Details: System.Unauthor izedAccessExcep tion: Access to the
>path '***' is denied.
But, if you create your own function to delete recursively the
directory, re create it, and reinstall the new file, all is fine.
Conclusion :
dont use : Directory.Delet e(xxx,true);
but :
/// <summary>
/// DirectoryDelete v1.0 by EL - 07/09/11
/// </summary>
/// <param name="pathIn"></param>
public void DirectoryDelete (string pathIn)
{
DirectoryInfo di = new DirectoryInfo(p athIn);
foreach (FileSystemInfo fsi in di.GetFileSyste mInfos())
{
if ((fsi.Attribute s & FileAttributes. Directory) != 0)
{
DirectoryDelete (fsi.FullName);
fsi.Delete();
}
else
{
fsi.Delete();
}
fsi.Refresh();
}
}
Ji*******@gmail .com wrote:
have you tried to give full control access to your app?
u may try to give full control( read , write, modify ) access to
EVERYONE.
right click the folder on your server -share and security -...
may it help, thanks
Ryan Gene
Steph wrote:
>hello, i ve a probleme when deleting a directory and when i want create
file immediatly after.
1) Directory.Delet e(myPath, true);
2) TextWriter sw = new StreamWriter(my Path +"test.aspx" );
i obtain
Exception Details: System.Unauthor izedAccessExcep tion: Access to the
path '***' is denied.
thanks