简体   繁体   中英

How to extract the credentials sent through NetworkCredentials class in WCF Application?

I am working on a project where the credentials are sent from Windows mobile(Compact Framework) through the NetworkCredentials object. I need to extract the credentials from the Header and authenticate against the LDAP server in the WCF application. Is there a way to do it ? Any suggestions would be welcomed !

You don't need to extract credentials, pass the NetworkCredential object direclty to LDAP:

public static bool login(string domain, System.Net.NetworkCredential cred)
{
    try
    {
        LdapConnection conn = new LdapConnection(domain);
        conn.Bind(cred);
        return true; 
    }
    catch (Exception ex)
    {
        throw ex;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM