久久久久久久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í)延遲太長(運(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 —— 有沒有更高效的語法?)
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)用)
主站蜘蛛池模板: 国产精品欧美精品日韩精品 | 国产精品免费在线 | 久久男人| 久久视频免费观看 | 亚洲国产一区二区视频 | 天天色综 | 色综合久 | 日韩一区二区三区精品 | 亚洲精品国产区 | 夜夜夜久久久 | 日本久久久久久久久 | 亚洲一区二区免费视频 | 亚洲国产精品99久久久久久久久 | 成人黄在线观看 | 国产91黄色 | 日日干日日射 | 国产精品伦一区二区三级视频 | 久久久五月天 | 91亚洲国产精品 | 久草在线在线精品观看 | 欧美激情综合色综合啪啪五月 | 中文字幕日韩欧美 | 天堂亚洲网 | 国产精品久久 | 国产成人99久久亚洲综合精品 | 中文字幕一区在线观看视频 | 亚洲精品在| 日本福利视频免费观看 | 成人不卡在线 | 99re热精品视频 | 91精品在线播放 | 欧美日韩久 | 在线中文视频 | 黄色大片免费播放 | 美女网站视频免费黄 | 久久亚洲一区二区 | 亚洲人成一区二区三区性色 | 亚洲精品大全 | 免费国产网站 | 亚洲成av人片在线观看无码 | 亚洲国产欧美91 |