привет пишу парсер данных сайта, не получается пройти аутефикацию.
Есть сервер IIS первоначально аутефикация проходит следующим образом:
http://www.cyberforum.ru/attachment....1&d=1347448168
не могу понять каким образом подключится через LDAP или через WinNT?
в IE пишет подключение к COMP-I.C-17.internal введите логин пароль, код ниже. Помогите!
http://s2.hostingkartinok.com/uploads/images/2012/09/01b25a0431f24511f0e4d9fd4a309f5e.jpg
public static bool AuthenticateUser(string domain, string username, string password)
{
string domainAndUsername = domain + @"\" + username;
string LDAPPATH = "
LDAP://COMP-I/C-17";
DirectoryEntry entry = new DirectoryEntry(LDAPPATH, domainAndUsername, password);
try
{
// Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + username + ")";
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();
if (null == result)
{
return false;
}
// Update the new path to the user in the directory
LDAPPATH = result.Path;
}
catch (Exception ex)
{
throw new Exception("Error authenticating user." + ex.Message);
}
return true;
}
13.09.12 15:07: Перенесено модератором из '.NET' — kochetkov.vladimir