使用 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);
...

留言

熱門文章