Ради будущих поколений (: D) вы также можете использовать любой из них:
soup3.select('a[id="review_next_page_link"]')[0]['href']
#or
soup3.select_one('a[id="review_next_page_link"]')['href']
#or
soup3.select('#review_next_page_link')[0]['href']
... и я уверен, что есть и другие способы сделать это. Все они выводят:
'/reviews/in/hotel/best-western-star-residency.html'
Попробуйте это:
class Program
{
static void Main(string[] args)
{
const string ldap = "LDAP://your-ldap-server-here";
using (DirectoryEntry conn = new DirectoryEntry(ldap))
{
using (DirectorySearcher searcher = new DirectorySearcher(conn))
{
searcher.Filter = "(|(samAccountName=userA)(samAccountName=userB))";
searcher.PropertiesToLoad.Add("samAccountName");
searcher.PropertiesToLoad.Add("userAccountControl");
using (SearchResultCollection results = searcher.FindAll())
{
foreach (SearchResult result in results)
{
int userAccountControl = Convert.ToInt32(result.Properties["userAccountControl"][0]);
string samAccountName = Convert.ToString(result.Properties["samAccountName"][0]);
bool disabled = ((userAccountControl & 2) > 0);
Console.WriteLine("{0} ({1:x}) :: {2}", samAccountName, userAccountControl, disabled);
}
}
}
}
Console.ReadLine();
}
}
Второй бит userAccountControl
будет 1, если учетная запись будет отключена.
Попробуйте эту запись:
http://www.codeproject.com/KB/system/everythingInAD.aspx#42
Вы захотите исследовать флаги Управления учетными записями пользователей.
Не проверяя биты, добавляя:
(userAccountControl:1.2.840.113556.1.4.803: = 2)
к Вашему фильтру должен возвратить только отключенных пользователей. Конечно,
(! userAccountControl:1.2.840.113556.1.4.803: = 2)
гарантирует, что пользователи не отключены, если Вы предпочли бы идти тем путем.
If you are using .NET 3.5, you can use the new System.DirectoryServices.AccountManagment namespace methods to much more easily access Active Directory. The UserPrincipal object has an Enabled property that gives you what you are looking for.
There is a good overview of these routines in the January 2008 MSDN Magazine. You can read the article online here: Managing Directory Security Principals in the .NET Framework 3.5