Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > LDAP and asp

Reply
Thread Tools

LDAP and asp

 
 
TomB
Guest
Posts: n/a
 
      04-16-2004
I'm trying to browse our Active Directory.
I found the following on a website

<CODE>
Set oRootDSE = GetObject("LDAP://RootDSE")
Set oDomain = GetObject("LDAP://" & oRootDSE.Get("DefaultNamingContext"))

Call EnumOUs(oDomain.ADsPath)

Sub EnumOUs(sADsPath)

Set oContainer = GetObject(sADsPath)
oContainer.Filter = Array("OrganizationalUnit")
For Each oOU in oContainer
WScript.Echo oOU.ADsPath
EnumUsers(oOU.ADsPath)
EnumOUs(oOU.ADsPath)
Next

End Sub

Sub EnumUsers(sADsPath)

Set oContainer = GetObject(sADsPath)
oContainer.Filter = Array("User")
For Each oADobject in oContainer

WScript.Echo oADobject.sAMAccountName
WScript.Echo oADobject.displayName
WScript.Echo oADobject.Description
WScript.Echo oADobject.employeeID

Next

End Sub

</CODE>

Which works fine as a WSH script.

I tried changing all of the WScript.Echo 's to Response.write 's but it
chokes on the second line.
(chokes = could not find table)
Could someone tell me what I'm doing wrong.

I've used ADSI successfully before, but now that we are on Active Directory,
I can't seem to get what I want.

Thanks
Tom B


 
Reply With Quote
 
 
 
 
rwg
Guest
Posts: n/a
 
      04-19-2004
You didn't list your error codes, but I tried this, I received an error code: error '8007054b'

This error implies a security context issue.

I changed my asp page to use Integrated Windows security, forcing this page to run under my domain credentials, and it worked. I hope this works for you
also.

-rwg
This is what I think, not necessarily what is accurate!

--------------------
| From: "TomB" <(E-Mail Removed)>
| Subject: LDAP and asp
| Date: Fri, 16 Apr 2004 12:12:49 -0400
| Lines: 52
| Newsgroups: microsoft.public.inetserver.asp.general
|
| I'm trying to browse our Active Directory.
| I found the following on a website
|
| <CODE>
| Set oRootDSE = GetObject("LDAP://RootDSE")
| Set oDomain = GetObject("LDAP://" & oRootDSE.Get("DefaultNamingContext"))
|
| Call EnumOUs(oDomain.ADsPath)
|
| Sub EnumOUs(sADsPath)
|
| Set oContainer = GetObject(sADsPath)
| oContainer.Filter = Array("OrganizationalUnit")
| For Each oOU in oContainer
| WScript.Echo oOU.ADsPath
| EnumUsers(oOU.ADsPath)
| EnumOUs(oOU.ADsPath)
| Next
|
| End Sub
|
| Sub EnumUsers(sADsPath)
|
| Set oContainer = GetObject(sADsPath)
| oContainer.Filter = Array("User")
| For Each oADobject in oContainer
|
| WScript.Echo oADobject.sAMAccountName
| WScript.Echo oADobject.displayName
| WScript.Echo oADobject.Description
| WScript.Echo oADobject.employeeID
|
| Next
|
| End Sub
|
| </CODE>
|
| Which works fine as a WSH script.
|
| I tried changing all of the WScript.Echo 's to Response.write 's but it
| chokes on the second line.
| (chokes = could not find table)
| Could someone tell me what I'm doing wrong.
|
| I've used ADSI successfully before, but now that we are on Active Directory,
| I can't seem to get what I want.
|
| Thanks
| Tom B
|
|
|


 
Reply With Quote
 
 
 
 
TomB
Guest
Posts: n/a
 
      04-19-2004
Interesting. Thanks for your input. I am running under Integrated
Security.
My error code is 0x800A000D
and the message is a Type Mismatch on Line 17, which is the second line
Set oDomain = GetObject("LDAP://" & oRootDSE.Get("DefaultNamingContext"))

If I Response.Write oRootDSE.Get("DefaultNamingContext")) I get....
DC=ourdomain,DC=ca

Which seems correct.

Thanks again for your help

""rwg"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You didn't list your error codes, but I tried this, I received an error

code: error '8007054b'
>
> This error implies a security context issue.
>
> I changed my asp page to use Integrated Windows security, forcing this

page to run under my domain credentials, and it worked. I hope this works
for you
> also.
>
> -rwg
> This is what I think, not necessarily what is accurate!
>
> --------------------
> | From: "TomB" <(E-Mail Removed)>
> | Subject: LDAP and asp
> | Date: Fri, 16 Apr 2004 12:12:49 -0400
> | Lines: 52
> | Newsgroups: microsoft.public.inetserver.asp.general
> |
> | I'm trying to browse our Active Directory.
> | I found the following on a website
> |
> | <CODE>
> | Set oRootDSE = GetObject("LDAP://RootDSE")
> | Set oDomain = GetObject("LDAP://" &

oRootDSE.Get("DefaultNamingContext"))
> |
> | Call EnumOUs(oDomain.ADsPath)
> |
> | Sub EnumOUs(sADsPath)
> |
> | Set oContainer = GetObject(sADsPath)
> | oContainer.Filter = Array("OrganizationalUnit")
> | For Each oOU in oContainer
> | WScript.Echo oOU.ADsPath
> | EnumUsers(oOU.ADsPath)
> | EnumOUs(oOU.ADsPath)
> | Next
> |
> | End Sub
> |
> | Sub EnumUsers(sADsPath)
> |
> | Set oContainer = GetObject(sADsPath)
> | oContainer.Filter = Array("User")
> | For Each oADobject in oContainer
> |
> | WScript.Echo oADobject.sAMAccountName
> | WScript.Echo oADobject.displayName
> | WScript.Echo oADobject.Description
> | WScript.Echo oADobject.employeeID
> |
> | Next
> |
> | End Sub
> |
> | </CODE>
> |
> | Which works fine as a WSH script.
> |
> | I tried changing all of the WScript.Echo 's to Response.write 's but it
> | chokes on the second line.
> | (chokes = could not find table)
> | Could someone tell me what I'm doing wrong.
> |
> | I've used ADSI successfully before, but now that we are on Active

Directory,
> | I can't seem to get what I want.
> |
> | Thanks
> | Tom B
> |
> |
> |
>
>



 
Reply With Quote
 
TomB
Guest
Posts: n/a
 
      04-19-2004
You're right, I'm a loser.

I have it set to Anonymous on my developer server.

Thanks

Tom B

""rwg"" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You didn't list your error codes, but I tried this, I received an error

code: error '8007054b'
>
> This error implies a security context issue.
>
> I changed my asp page to use Integrated Windows security, forcing this

page to run under my domain credentials, and it worked. I hope this works
for you
> also.
>
> -rwg
> This is what I think, not necessarily what is accurate!
>
> --------------------
> | From: "TomB" <(E-Mail Removed)>
> | Subject: LDAP and asp
> | Date: Fri, 16 Apr 2004 12:12:49 -0400
> | Lines: 52
> | Newsgroups: microsoft.public.inetserver.asp.general
> |
> | I'm trying to browse our Active Directory.
> | I found the following on a website
> |
> | <CODE>
> | Set oRootDSE = GetObject("LDAP://RootDSE")
> | Set oDomain = GetObject("LDAP://" &

oRootDSE.Get("DefaultNamingContext"))
> |
> | Call EnumOUs(oDomain.ADsPath)
> |
> | Sub EnumOUs(sADsPath)
> |
> | Set oContainer = GetObject(sADsPath)
> | oContainer.Filter = Array("OrganizationalUnit")
> | For Each oOU in oContainer
> | WScript.Echo oOU.ADsPath
> | EnumUsers(oOU.ADsPath)
> | EnumOUs(oOU.ADsPath)
> | Next
> |
> | End Sub
> |
> | Sub EnumUsers(sADsPath)
> |
> | Set oContainer = GetObject(sADsPath)
> | oContainer.Filter = Array("User")
> | For Each oADobject in oContainer
> |
> | WScript.Echo oADobject.sAMAccountName
> | WScript.Echo oADobject.displayName
> | WScript.Echo oADobject.Description
> | WScript.Echo oADobject.employeeID
> |
> | Next
> |
> | End Sub
> |
> | </CODE>
> |
> | Which works fine as a WSH script.
> |
> | I tried changing all of the WScript.Echo 's to Response.write 's but it
> | chokes on the second line.
> | (chokes = could not find table)
> | Could someone tell me what I'm doing wrong.
> |
> | I've used ADSI successfully before, but now that we are on Active

Directory,
> | I can't seem to get what I want.
> |
> | Thanks
> | Tom B
> |
> |
> |
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python-ldap/win32 or python/ldap/win32 rcmn Python 1 11-06-2006 11:47 PM
Need to wrtie LDAP class to *answer* LDAP queries. junk1@davidbevan.co.uk Java 1 02-21-2006 09:59 PM
ruby-ldap: uninitialized constant LDAP::LDAP_CONTROL_PAGEDRESULTS James Hughes Ruby 4 12-13-2005 11:46 PM
[ANN] Ruby/LDAP 0.9.1: LDAP API (RFC1823) library. Ian Macdonald Ruby 0 03-15-2005 11:23 PM
using LDAP Controls in ruby-ldap Jason Wold Ruby 5 11-07-2004 03:35 AM



Advertisments