Re: Error trying form authentication against AD

From: Edward Henn (henne@saccourt.com.no.spam)
Date: 04/01/03

  • Next message: Mike Moore [MSFT]: "RE: Sporadic HTTP 401 Permission Denied Error"
    From: "Edward Henn" <henne@saccourt.com.no.spam>
    Date: Tue, 1 Apr 2003 08:39:13 -0800
    
    

    I encountered many problems when first trying this code to get to AD. Took
    some time for me to find the right connection string to reach AD.

    First thing you should do is verify you are using the right connection
    string. You can look at Active Directory with one of the native tools to
    verify where the user you are searching for is located, if you need to
    specify an OU, etc. Good luck.

    Ed Henn

    Sacramento Superior Court

    "Beginner" <bzhang@hotmail.com> wrote in message
    news:O#Z3r5HzCHA.2296@TK2MSFTNGP10...
    > I'm trying the samples in Q326340. When calling function
    IsAuthenticated(),
    > if I try wrong name or password, the error message is "Unkonw user" by
    Throw
    > Exception; If I give the right name and password, search.FindOne() returns
    > nothing.
    >
    > Seems it did connected to LDAP server, but just could get result. What
    > could be the problem? Thanks.
    >
    >
    > 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
    >
    >


  • Next message: Mike Moore [MSFT]: "RE: Sporadic HTTP 401 Permission Denied Error"

    Relevant Pages

    • Re: ADO connections question
      ... Function CreateADOObjects(ConnectionString as string) ... you'll see this error if the connection has not been ... I have a specific login form that calls the dbLogin function as shown ... Dim strCriteria As String ...
      (microsoft.public.access.adp.sqlserver)
    • Re: Nochmals Treeview
      ... private void button1_Click(object sender, System.EventArgs e) { ... private void TabelleAnlegen(string strDBPfad, string strDB, string strTabellenName){ ... OleDbConnection connection = new OleDbConnection; ... OleDbCommand command = new OleDbCommand; ...
      (microsoft.public.de.german.entwickler.dotnet.csharp)
    • Re: ExecuteReader requires an open and available Connection.
      ... you have ALL your users sharing one connection. ... Public Shared Function GetServerAs String ... Dim theServer As String ...
      (microsoft.public.dotnet.framework.aspnet)
    • RE: Error using Login control ASP.NET App_Data Folder
      ... the UserInstance type of connection string is for SQLEXPRESS only and is ... Server Management Studio and use a standard connection ... An error has occurred while establishing a connection to the server. ... SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, ...
      (microsoft.public.dotnet.framework.aspnet)
    • Change Connection String during runtime
      ... connection is stored in the app.config file. ... connection string without exiting the application. ... Dim newConnection As String ... Private Sub RecordDatabase_Enter(ByVal sender As Object, ...
      (microsoft.public.dotnet.languages.vb)

  • Quantcast