Re: Code works in Windows app. but not in ASP.Net



This looks like a serverless binding problem. That requires a domain
security context to work, and you may not have that in ASP.NET. What if you
path looks like this:

LDAP://qutopia.questus.no/OU=admintest,DC=qutopia,DC=questus,DC=no

The username format you are using should be fine.

Joe K.

"Rolf Barbakken" <notnoisy@xxxxxxxxxxxxx> wrote in message
news:%23vLzamqUGHA.5808@xxxxxxxxxxxxxxxxxxxxxxx
The following is the actual code, minus actual username and password,
obviously:

de = New
System.DirectoryServices.DirectoryEntry("LDAP://OU=admintest,DC=qutopia,DC=questus,DC=no";)
de.Username = "qutopia\username"
de.Password = "userpassword"

I have tried replacing username with just "username", and tried reversing
the slash. I also tried specifying the entire domain name
"qutopia.questus.no\username" but I just get the following error:
"The specified domain either does not exist or could not be contacted"

I guessed that the context is a bit different for a Windows-app than a
webpage, but as the directoryentry have properties for both username and
password I thought I could get around that.


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:OWCVoIoUGHA.4300@xxxxxxxxxxxxxxxxxxxxxxx
This depends a great deal on the actual value of the path you are using.
Can you show that?

Note also that since your code does not supply credentials to the
DirectoryEntry, you will be using the current security context in ASP.NET
to connect to AD. That will nearly always be different there than in a
console app, so different results are to be anticipated.

Joe K.

"Rolf Barbakken" <notnoisy@xxxxxxxxxxxxx> wrote in message
news:upATsukUGHA.5808@xxxxxxxxxxxxxxxxxxxxxxx
I get this error in the webbrowser:
"The specified domain either does not exist or could not be contacted"

The code for the procedure is:
Sub ListUsers(ByVal DOMAIN As String, ByVal OU As String)
Dim srch As System.DirectoryServices.DirectorySearcher
Dim result As System.DirectoryServices.SearchResult
Dim de, dir As System.DirectoryServices.DirectoryEntry

de = New System.DirectoryServices.DirectoryEntry("LDAP://"; &
DOMAIN & "/" & OU)
srch = New System.DirectoryServices.DirectorySearcher(de)
srch.Filter = "(&(objectClass=user)(objectCategory=person))"

For Each result In srch.FindAll()
dir = result.GetDirectoryEntry
txtTest.Text = txtTest.Text &
dir.Properties("distinguishedName").Value & vbCrLf
Next
End Sub

I use the exact same code and the exact same call to the procedure in a
test Windows-app with no problems. So I am guessing some rights problem.
Which rights are needed and which user needs them?

Thanks.


--
_________________
Rolf @ Questus ans








.



Relevant Pages

  • Re: Query AD using Integrated Authentication?
    ... trying to do a bind with a username and a blank password. ... The way you have to do this with WIA is to impersonate the logged on user ... the credentials of the current security context (the user you are ... how to pass the username/password information while using Integrated ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: LDAP, Email
    ... If your current security context is not a domain identity or cannot ... try changing your DirectoryEntry constructor to supply ... Dim oDS As New DirectorySearcher ... Dim strEmail As String ...
    (microsoft.public.dotnet.security)
  • Re: UsernameTokenManager.AuthenticateUser
    ... Using WSE3 username over certificate and implementing: ... However now the client has to invalidate the security context somehow. ... proxy = new Proxy; ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • impersonate in new thread
    ... My ASP.NET application sets up impersonate in the config file: ... Dim thread As New Thread ... I suspect this thread does not have the same security context as the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Programmatic Account Impersonation
    ... a user enters their NT username and password the application's ... security context can be changed to run under their account. ... Scott ...
    (microsoft.public.dotnet.general)