nobelo - Do 22.11.07 00:48
Titel: Verzeichnis auf Zugriffsrechte Prüfen
Hallo Leute,
Ich will eine Methode schreiben, die true zurückgibt wenn das Verzeichnis zugriffbar ist und false wenn nicht. Es handelt sich um ein Verzeichnis im Netzwerk.
folgendes habe ich:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
| public void isWriteable() { pathC = ConfigurationManager.AppSettings.Get("PathC"); DirectoryInfo dInfo = new DirectoryInfo(pathC);
if (Directory.Exists(pathC)) { try { DirectorySecurity dSecurity = dInfo.GetAccessControl(); Console.WriteLine("Rechte"); } catch (Exception) { Console.WriteLine("Keine Rechte"); } } else { throw new Exception("Verzeichnis existiert nicht"); } } |
Doch wie bekommen ich aus der GetAccessControl() Methode einen booleschen Wert zurück? Oder hat jemand ne andere Idee?
Gruß
nobelo
Moderiert von Christian S.: C#-Tags hinzugefügtModeriert von Christian S.: Topic aus Sonstiges (C# / .NET) verschoben am Do 22.11.2007 um 00:04