小编Ken*_*Lai的帖子

c# DirectoryEntry.Properties 与 DirectoryEntry.InvokeGet?

当我尝试从活动目录检索“AccountExpirationDate”时,我遇到了一个奇怪的问题。

我使用以下代码来检索用户:

        DirectoryEntry dirEntry = new DirectoryEntry(Path);
        DirectorySearcher search = new DirectorySearcher(dirEntry);

        // specify the search filter
        search.Filter = "(&(objectClass=user)(mail=" + email + "))";

        // perform the search
        SearchResult result = search.FindOne();
        DirectoryEntry user = result.GetDirectoryEntry();
Run Code Online (Sandbox Code Playgroud)

然后我检索“AccountExpirationDate”:

object o1 = user.Properties["accountExpires"].Value; //return a COM object and I cannot retrieve anything from it
object o2 = user.Properties["AccountExpirationDate"].Value; //return null
object o3 = user.InvokeGet("AccountExpirationDate"); //return the DateTime
Run Code Online (Sandbox Code Playgroud)

所以我想知道这里发生了什么?为什么我无法使用 DirectoryEntry.Properties 检索 AccountExpirationDate?DirectoryEntry.Properties 与 DirectoryEntry.InvokeGet 之间有什么不同?

多谢。

c# active-directory

5
推荐指数
1
解决办法
1967
查看次数

Azure Active Directory 的自定义登录页面是否可行?

我正在开发一个使用 Azure AD 作为身份提供者的 .NET Web 应用程序。还使用 Azure MFA。

但是,用户不想使用默认的 Microsoft 登录页面。相反,他们想要使用自定义登录页面(由我们托管)。有可能的?

Azure AD 中是否存在任何 API 来验证用户的凭据?我试过这个:https : //azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-native-headless/。但我不能让它在 Web 应用程序上工作。

azure-active-directory

5
推荐指数
1
解决办法
4393
查看次数

PHP如何检测变量的变化?

PHP是否存在检测变量变化的函数?这是这样的:

//called when $a is changed.
function variableChanged($value) {
    echo "value changed to " . $value;
}

$a = 1;
//attach the variable to the method.
$a.attachTo("variableChanged");
$a = 2;
$a = 3;

//expected output:
//value changed to 2
//value changed to 3
Run Code Online (Sandbox Code Playgroud)

我知道如果我使用"setter"方法很容易实现.但由于我正在处理一些现有代码,我无法修改它们.有人能告诉我如何实现我的目的吗?谢谢.

php

2
推荐指数
1
解决办法
6332
查看次数