久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何知道我的 DirectoryEntry 是否真的連接到我的

How to know if my DirectoryEntry is really connected to my LDAP directory?(如何知道我的 DirectoryEntry 是否真的連接到我的 LDAP 目錄?)
本文介紹了如何知道我的 DirectoryEntry 是否真的連接到我的 LDAP 目錄?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我正在連接到 C# 中的 LDAP 目錄,因此我使用了 DirectoryEntry 類.

I'm connecting to a LDAP directory in C#, so I've used the DirectoryEntry class.

當(dāng)您使用地址、登錄名和密碼執(zhí)行new DirectoryEntry"時,它應(yīng)該連接到 LDAP 目錄.

When you do the "new DirectoryEntry" with address, login, and password it is supposed to connect to the LDAP directory.

然而,即使連接不工作,它也毫無問題地返回,并且設(shè)置了目錄項變量.

However, even if the connection didn't work, it returns without problem, and the directoryentry variable is set.

所以我知道我的連接真的打開了嗎?現(xiàn)在,我正在使用一個非常非常丑陋的 hack :我放置了一個if(mydirectory.SchemaEntry)",如果沒有建立連接,它會生成一個異常,因為 DirectoryEntry 的一些成員,例如 SchemaEntry,如果連接失敗,則不設(shè)置.但是 1:這在丑陋的尺度上必須是 11/10 2:在失敗之前需要很多時間.

So i do i know my connection is really opened ? Right now, I'm using a very very ugly hack : i put a "if(mydirectory.SchemaEntry)" which generates an exception if the connection wasn't etablished, because some of the members of the DirectoryEntry, such as SchemaEntry, aren't set if the connection failed. But 1:that's gotta be 11/10 on the ugliness scale 2:that takes a lot of time before failing.

那么這樣做的好方法是什么?當(dāng)然,Microsoft 一定提供了一些信息(即使我使用的是 LDAP 目錄而不是 Active Directory)來了解我是否真的已連接?

So what is the good way to do this ? Surely, Microsoft must have provided something (even if I'm using a LDAP directory and not an Active Directory) to know if I'm really connected ?

推薦答案

好吧,marc_s 的解決方案與我正在做的差不多(除了我在尋找 SchemaEntry 而不是 NativeObject).但是超時延遲太長(運行查詢以填充表單的自動完成值).我想我實際上更喜歡假裝連接是打開的并讓查詢運行.這樣,我可以設(shè)置自己的更小超時延遲.

Ok so marc_s's solution was approximately what i was doing (except i was looking for SchemaEntry and not NativeObject). But the timeout delay is much too long (the query is run to fill autocompletion values for a form). I think I actually prefer to pretend the connection is open and let the query run. That way, i can set my own, smaller, timeout delay.

這篇關(guān)于如何知道我的 DirectoryEntry 是否真的連接到我的 LDAP 目錄?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Why shouldn#39;t I always use nullable types in C#(為什么我不應(yīng)該總是在 C# 中使用可空類型)
C# HasValue vs !=null(C# HasValue vs !=null)
C# ADO.NET: nulls and DbNull -- is there more efficient syntax?(C# ADO.NET:空值和 DbNull —— 有沒有更高效的語法?)
How to set null value to int in c#?(如何在c#中將空值設(shè)置為int?)
How to handle nulls in LINQ when using Min or Max?(使用 Min 或 Max 時如何處理 LINQ 中的空值?)
Method call if not null in C#(在 C# 中如果不為 null 的方法調(diào)用)
主站蜘蛛池模板: 久久婷婷国产麻豆91 | 久久久久国产一区二区三区不卡 | 成人精品啪啪欧美成 | 黄色免费网站在线看 | 中文字幕一区二区三区四区五区 | 日韩美香港a一级毛片免费 国产综合av | 日韩中文字幕在线不卡 | 欧美精品在线播放 | 鸳鸯谱在线观看高清 | 欧美日韩大片 | 久草青青 | 国产精品视频一 | 91精品国产91久久久久久 | 亚洲视频区 | 国产一区二区三区四区五区加勒比 | 久久极品 | 日韩精品一区二区三区在线播放 | 午夜视频在线免费观看 | 阿v视频在线观看 | 99小视频 | 欧美激情视频一区二区三区在线播放 | 国产在线播放一区二区三区 | 精品久久国产老人久久综合 | 日本不卡免费新一二三区 | 久久宗合色| 在线一区二区三区 | 久久精彩 | 亚洲免费人成在线视频观看 | 欧美精品黄 | 国产一级片一区二区 | 亚州精品天堂中文字幕 | 91tv在线观看| 亚洲高清一区二区三区 | 国产高清免费视频 | 国产 日韩 欧美 制服 另类 | 国产成人免费视频网站视频社区 | 午夜在线小视频 | 国产成人精品高清久久 | 国产一二区免费视频 | 免费视频一区 | 青青草视频网 |