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

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

How to know if my DirectoryEntry is really connected to my LDAP directory?(如何知道我的 DirectoryEntry 是否真的連接到我的 LDAP 目錄?)
本文介紹了如何知道我的 DirectoryEntry 是否真的連接到我的 LDAP 目錄?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(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"時(shí),它應(yīng)該連接到 LDAP 目錄.

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

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

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

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

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í)延遲太長(zhǎng)(運(yùn)行查詢以填充表單的自動(dòng)完成值).我想我實(shí)際上更喜歡假裝連接是打開的并讓查詢運(yùn)行.這樣,我可以設(shè)置自己的更小超時(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 目錄?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 —— 有沒有更高效的語(yǔ)法?)
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 時(shí)如何處理 LINQ 中的空值?)
Method call if not null in C#(在 C# 中如果不為 null 的方法調(diào)用)
主站蜘蛛池模板: 久久久亚洲综合 | 午夜理伦三级理论三级在线观看 | 久久久久国产一区二区三区四区 | 欧美精品一区二区三区在线播放 | 在线观看www高清视频 | 中文字幕在线一区二区三区 | 久久久久久av | 国产精品久久久久aaaa九色 | 国产成人综合在线 | www.日韩系列 | 在线色网 | 色婷婷综合久久久久中文一区二区 | 国产乱码久久久久久 | 最新中文字幕 | 久久在线 | 在线综合视频 | 国产成人精品一区二 | 中文字幕亚洲视频 | 亚洲免费在线视频 | 在线观看免费黄色片 | 久久精品中文字幕 | 欧美一区二区免费视频 | 精品视频在线观看 | 黄色大片在线视频 | 欧美日韩国产免费 | 四虎成人免费电影 | 亚洲视频免费一区 | 一区二区三区四区在线免费观看 | 成人午夜网 | 91视频电影| 亚洲欧美日韩一区二区 | 在线免费小视频 | 中文字幕在线一区二区三区 | 色毛片 | 日本免费视频在线观看 | 操久久 | 日本午夜免费福利视频 | 天天av综合| 国产亚洲一区二区三区 | 久久国产区 | 国产精品一区二区精品 |