【发布时间】:2017-11-01 00:14:14
【问题描述】:
首先我想指出,所有需要的访问权限都已获得。
private static IEnumerable<FileSystemAccessRule> GetDirectoryAccessRules(string directoryPath)
{
AuthorizationRuleCollection rules = Directory.GetAccessControl(directoryPath);
问题是如果directoryPath 包含'.' 作为'localhost' 将抛出异常。 (InvalidOperationException)。如果在'localhost' 上更改了'.',则一切正常。
除了常规的字符串修改之外,有没有什么好的方法可以解决这种情况? Path.Combine 之类的?
【问题讨论】:
标签: c# .net directory localhost