Имя: Пароль:
IT
Веб-мастеринг
Какой способ аутентификации приведен?
0 AugustBlack
 
13.09.12
07:19
привет,может кто подскажитет.
пишу парсер данных сайта, не получается пройти аутефикацию.
Есть сервер IIS первоначально аутентификация проходит следующим образом:
http://s2.hostingkartinok.com/uploads/images/2012/09/01b25a0431f24511f0e4d9fd4a309f5e.jpg

не могу понять каким образом подключится через LDAP или через WinNT?
в IE пишет подключение к COMP-I.C-17.internal введите логин пароль, код ниже.



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;
}