# How to enable SSL for Active Directry in Radzen

**URL:** <https://forum.radzen.com/t/how-to-enable-ssl-for-active-directry-in-radzen/4146>\
**Category:** Angular\
**Created:** [July 4, 2020, 9:55pm UTC](https://forum.radzen.com/t/how-to-enable-ssl-for-active-directry-in-radzen/4146 "2020-07-04T21:55:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alistair](https://forum.radzen.com/user_avatar/forum.radzen.com/alistair/32/1011_2.png) [@alistair](https://forum.radzen.com/u/alistair)\
**Post date:** [July 4, 2020, 9:55pm UTC](https://forum.radzen.com/t/how-to-enable-ssl-for-active-directry-in-radzen/4146/1 "2020-07-04T21:55:39Z")

</div>

I was faced with a IT department moving to SSL/ldap, currently Radzen does not support this.

[Microsoft LDAP Signing](https://petri.com/microsoft-delays-ldap-signing-and-channel-binding-changes-in-active-directory)

In your Radzen application add

server\Authentication\ApplicationUserManager.cs to the Code generation ignore list in settings

 ![image](https://forum.radzen.com/uploads/default/original/2X/2/29156798b9befe4fc40c1d73a2745beb06c0303e.png)

You will need to make the following changes in a code editor to ApplicationUserManager.cs

In the function

> private LdapEntry FindUser(string userName)

Under

> var connection = new LdapConnection();

Add the following lines

> connection.SecureSocketLayer = true;  
> connection.UserDefinedServerCertValidationDelegate += (sender, cert, chain, sslPolicyErrors) =\> { return true; };

Change the following line

> connection.Connect(options.Server, LdapConnection.DefaultPort);

to

> connection.Connect(options.Server, LdapConnection.DefaultSslPort);

The final code should look like this

> ```
> private LdapEntry FindUser(string userName)
> 
> ```

```
    {
        var baseDN = String.Join(",", this.Domain.Split('.').Select(dc => $"dc={dc.ToLower()}"));

        var connection = new LdapConnection();

        connection.SecureSocketLayer = true;

        connection.UserDefinedServerCertValidationDelegate += (sender, cert, chain, sslPolicyErrors) => { return true; };

        try
        {
            connection.Connect(options.Server, LdapConnection.DefaultSslPort);
            connection.Bind(options.User, options.Password);
            var cons = new LdapSearchConstraints();
            cons.ReferralFollowing = true;

            var searchResults = connection.Search(baseDN, LdapConnection.ScopeSub,
                $"(sAMAccountName={userName.ToLower()})", null, false, cons);

            while (searchResults.HasMore())
            {
                try
                {
                    return searchResults.Next();
                }
                catch (LdapException)
                {
                }

            }
        }
        catch (LdapException)
        {

        }
        finally
        {
            connection.Disconnect();
        }

        return null;
    }

```
