LDAP Auth Problem - COM interop

Discussion in 'ASP .Net Security' started by Chris Davoli, Sep 16, 2006.

  1. Chris Davoli

    Chris Davoli Guest

    Environment: Win XP, VS2003, Active Directory
    I'm trying to use LDAP to authenticate users. I used article
    http://support.microsoft.com/?id=326340
    How to authenticate against the Active Directory by using forms
    authentication and Visual Basic .NET, but am having a COM interop error when
    I do the IsAuthenticated try to create an object entry.NativeObject ie; Dim
    obj As Object = entry.NativeObject

    The COM interop error is <error: an exception of type:
    {System.Runtime.InteropServices.COMException} occurred>

    I'm thinking that there is some kind of COM component that is either not
    registered, or not there.

    Can anyone help me?

    Here is the code AND after that is the error stack.:

    Public Function IsAuthenticated(ByVal domain As String, ByVal
    username As String, ByVal pwd As String) As Boolean

    Dim domainAndUsername As String = domain & "\" & username
    Dim entry As DirectoryEntry = New DirectoryEntry(_path,
    domainAndUsername, pwd)

    Try
    'Bind to the native AdsObject to force authentication.
    Dim obj As Object = entry.NativeObject
    Dim search As DirectorySearcher = New DirectorySearcher(entry)

    search.Filter = "(SAMAccountName=" & username & ")"
    search.PropertiesToLoad.Add("cn")
    Dim result As SearchResult = search.FindOne()

    If (result Is Nothing) Then
    Return False
    End If

    'Update the new path to the user in the directory.
    _path = result.Path
    _filterAttribute = CType(result.Properties("cn")(0), String)

    Catch ex As Exception
    Throw New Exception("Error authenticating user. " &
    ex.Message)
    End Try

    Return True
    End Function
    --
    Server Error in '/FormsAuthAd' Application.
    --------------------------------------------------------------------------------

    The requested authentication method is not supported by the server
    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: The
    requested authentication method is not supported by the server

    Source Error:


    Line 22: 'Try
    Line 23: 'Bind to the native AdsObject to force authentication.
    Line 24: Dim obj As Object = entry.NativeObject
    Line 25: Dim search As DirectorySearcher = New
    DirectorySearcher(entry)
    Line 26:


    Source File: C:\Inetpub\wwwroot\FormsAuthAd\LdapAuthentication.vb Line: 24

    Stack Trace:


    [COMException (0x80072027): The requested authentication method is not
    supported by the server]
    System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
    System.DirectoryServices.DirectoryEntry.Bind()
    System.DirectoryServices.DirectoryEntry.get_NativeObject()
    FormsAuthAd.FormsAuth.LdapAuthentication.IsAuthenticated(String domain,
    String username, String pwd) in
    C:\Inetpub\wwwroot\FormsAuthAd\LdapAuthentication.vb:24
    ASP.Logon_aspx.Login_Click(Object sender, EventArgs e) in
    c:\inetpub\wwwroot\FormsAuthAd\logon.aspx:21
    System.Web.UI.WebControls.Button.OnClick(EventArgs e)

    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
    sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
    System.Web.UI.Page.ProcessRequestMain() +1292




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
    Version:1.1.4322.2032


    --
    Chris Davoli
    Chris Davoli, Sep 16, 2006
    #1
    1. Advertising

  2. Chris Davoli

    Joe Kaplan Guest

    Is the XP box a member of the AD domain, or is it a standalone workgroup
    machine? Are there any important network restrictions between the machine
    and AD (such as Kerberos being blocked at the firewall or some other goofy
    thing)?

    Joe K.

    --
    Joe Kaplan-MS MVP Directory Services Programming
    Co-author of "The .NET Developer's Guide to Directory Services Programming"
    http://www.directoryprogramming.net
    --
    Joe Kaplan, Sep 16, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2hyaXMgTW9oYW4=?=

    Configuring Windows Auth & Forms Auth in Asp.Net

    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=, Apr 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    687
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Apr 28, 2004
  2. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Windows Auth, but Forms Auth for one page?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Jan 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    550
    Elton Wang
    Jan 8, 2005
  3. Mark Chai
    Replies:
    1
    Views:
    740
    Christophe Vanfleteren
    Oct 1, 2003
  4. Chris Mohan

    Configuring Windows Auth & Forms Auth in Asp.Net

    Chris Mohan, Apr 28, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    412
    Chris Mohan
    Apr 29, 2004
  5. Chris Davoli

    LDAP Auth Problem - COM interop

    Chris Davoli, Sep 14, 2006, in forum: ASP .Net Security
    Replies:
    4
    Views:
    161
    Joe Kaplan
    Sep 15, 2006
Loading...

Share This Page