다음 코드를 사용하여 세 번째 사용자로 가장하여 폴더에 액세스하려고합니다.C#에서 가장하여 FolderDialog를 사용하는 네트워크 폴더 열기
Boolean success = LogonUser("username", "domain", "password", 2, 0, out userToken);
if (success)
{
var wi = new WindowsIdentity(userToken, "WindowsAuthentication");
using (wi.Impersonate())
{
if (fbdPatches.ShowDialog() == DialogResult.OK)
{
// try to access folder which can be accessed only through above credentials
}
}
}
여전히 폴더에 액세스 할 수 없습니다. 제가 여기서 잘못된 일을하고 있는지 알아 보도록 도와주세요.
. "루트 폴더를 검색 할 수 없습니다." 실제로 folderBrowseDialog (fbdPatches) 루트 폴더를 설정하려고합니다. fbdPatches.SelectedPath = "SomeFolder"; – Adinarayana
당신은'LOGON32_LOGON_NEW_CREDENTIALS 9'을 시도 했습니까? – Kiquenet
질문을 편집하고 추가 정보를 추가 할 수 있습니다. '다음 오류가 있습니다. "루트 폴더를 검색 할 수 없습니다."실제로 folderBrowseDialog (fbdPatches) 루트 폴더를 설정하려고합니다. fbdPatches.SelectedPath = "SomeFolder" – Kiquenet