dosyaya yazmadan önce:Dosya erişimi sorunu
using (StreamWriter outfile = new StreamWriter(filePath, false, System.Text.Encoding.UTF8))
{
outfile.Write(content);
}
ben dosya yazma kontrol ediyorum bu kullanarak accsses: fonksiyonu üzerinde olmasına rağmen
public bool CheckIfAccessToFileIsGranted(string filePath)
{
try
{
new FileIOPermission(FileIOPermissionAccess.Write, filePath).Demand();
return true;
}
catch (SecurityException)
{
return false;
}
}
bana değerlendirmek verir (true döndürür) Akışı açarken UnauthorizedAccessException alıyorum. Niye ya ?
Selamlar
+1 sadece son cümle için ... –