Secure Connection TO LDAP Server

Last post 03-08-2007 10:32 AM by stcyrje. 0 replies.

Sort Posts:

  • Secure Connection TO LDAP Server

    03-08-2007, 10:32 AM
    • Member
      10 point Member
    • stcyrje
    • Member since 07-05-2006, 11:01 AM
    • Posts 3

     Hey everyone I am trying to implement a secure connection to a Novell eDirectory Server. I am having trouble with the VB I am using an activex LDAP control from novell NWIDirLib.

     Has anyone had any sucess with it before?

     THANKS!

    ERROR 

     Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Can't contact LDAP server

    [COMException (0x80040051): Can't contact LDAP server]
       NWIDirLib.NWIDirClass.Connect() +0
       NovellAuth.ValidateLogin(String loginId, String password) in W:\Departments\hr\recruitment\noninst\vb\sub_info.aspx.vb:137
       Login_Admin.btnLogin_Clicked(Object Sender, EventArgs E) in W:\Departments\hr\recruitment\noninst\vb\sub_info.aspx.vb:66
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain() +1292

     

     

     VB I AM USING...

    Public Function ValidateLogin(ByVal loginId As String, ByVal password As String) As String
            Dim ldap As New NWIDirLib.NWIDirClass
            Dim entries As NWIDirLib.NWEntries
            Dim entry As NWIDirLib.NWEntry
            Dim result As LoginResult
            Dim strGroup As String
            Try
       
       ldap.SecureConnection = true
       ldap.SecurePort = 636
       ldap.Credentials = "w:\Departments\hr\recruitment\NonInst\vb\SSL CertificateLDAP - NET-11-DS.der"  
                ldap.FullName = "ldap://192.168.1.11/o=dsbcc"
                ldap.LoginName = "ldap://192.168.1.11/o=dsbcc/ou=WEB/ou=USR/cn=usernamehere"
                ldap.Password = "passwordhere"
                ldap.Connect()
                ldap.Filter = "cn=" & loginId
                ldap.SearchScope = NWIDirLib.NWSearchScope.dirSearchSubtree
                ldap.SearchMode = NWIDirLib.NWSearchMode.dirSearchSynchronous
                entries = ldap.Search()
                If entries.Count = 0 Then
                    result = LoginResult.InvalidLoginId
                Else
                    entry = entries.Item(0)

                    If entry.ValidatePassword(password) Then
                        result = LoginResult.Authenticated
                    Else
                        result = LoginResult.InvalidPassword
                    End If
                End If
                ldap.Disconnect()
            Catch ex As SQlException
                result = LoginResult.RuntimeError
            End Try
            Return MyArray(result)
        End Function
    End Class

Page 1 of 1 (1 items)