2017年6月7日 星期三

使用 UNC 方式存取資料夾

先下載此檔案 UNCAccessWithCredentials.cs

使用方式
const string path = @"\\172.16.1.1\aaa";
 using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
            {
                unc.NetUseWithCredentials(path, 帳號, 網域, 密碼);
                var files = Directory.GetFiles(path).OrderBy(a => new FileInfo(a).CreationTime);
...

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...