473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ADSI User object

2
I have a vbScript function that works quite well, but fails when I attempt to run it in an ASP pages.

Here is the function:
Expand|Select|Wrap|Line Numbers
  1. Function GetGroups(DistinguishedName)
  2.     'Returns an array of groups or a 1-element array detailing the error.
  3.  
  4.     Const E_ADS_PROPERTY_NOT_FOUND  = &h8000500D
  5.  
  6.     Dim oUser,asGroups,sGp
  7.     Dim oConn,oCmd,oRS
  8.  
  9.                 'This object is not set correctly when on an ASP page
  10.     Set oUser = GetObject(DistinguishedName) 
  11.  
  12.     On Error Resume Next 
  13.     asGroups = oUser.GetEx("memberOf") 'An array of groups
  14.     If Err.Number <> 0 Then
  15.         if Err.Number = E_ADS_PROPERTY_NOT_FOUND Then
  16.             asGroups=Array("Err.Number","the member attribute is not set")
  17.         else
  18.         asGroups=Array(Err.Number, Err.Description)
  19.       end if
  20.     End If
  21.     GetGroups=asGroups
  22. End Function 
I've never had any problem using this from vbScript, as long as the logged-on user is a member of the domain.

I suspect that the problem arises because the asp page is running in a security context that does not allow the ojbect to be created.

How do I fix this?

Alternatives?

--Maugris
May 25 '07 #1
2 1924
jhardman
3,406 Expert 2GB
Maugris,

ASP is not object oriented so I don't think it will understand what you want. Maybe:
Expand|Select|Wrap|Line Numbers
  1. Set oUser = server.createObject(GetObject(DistinguishedName))
  2.  
Have you tried this in asp.net?

Jared
May 25 '07 #2
Vorpal
2
Expand|Select|Wrap|Line Numbers
  1. Set oUser = server.createObject(GetObject(DistinguishedName))
Have you tried this in asp.net?
Jared
Well, it was worth a shot.
I get a type mismatch, since createobject expects a string.

So far, I've never used asp.net.
I set up a test server today so I could begin learning it.
Not exactly a trivial learning curve.

For a workaround this time, I'm going to attempt to:
1. from the asp page run a shell script that puts the requested information in a text file.
2. Open the text file and iterate it looking for the groups I want.

It doesn't get much uglier. :)

If you're interested, I'll let you know if it works.

--Maugris
May 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: S. Lemen | last post by:
Hi, The CommitChanges method returns an error after earlier property ..Remove methods are successfull. The error is: "The attribute syntax specified to the directory service is invalid." ...
3
by: Philip Carnstam | last post by:
Hi, Can someone lead me through creating a user object in AD. I have tried creating one through LDAP and ADSI (WinNT://) but nothing happens. DirectoryEntry DE = new...
1
by: shiv | last post by:
Hi all I need to to know whether a User Account is Enabled or Disabled through ADSI. Kindly share a code snippet in c# which can do the same. I would also want to see the Properties of the...
2
by: CodeCowboy | last post by:
I'm sure some of you have done this before and I've been perusing through the forum trying to find some uncomplicated solution. I am trying to extend the existing user.identity object. I would...
1
by: UJ | last post by:
I have a page that I am going to convert to a user object that works just fine. Problem is it displays a prompt by checking a hidden text field on load to see if it should display it. Which means I...
0
by: S Lemen | last post by:
Hi, How are Active Directory user object attributes removed in VB .Net? The remove method succeeds but the CommitChanges errors with: "The attribute syntax specified to the directory service...
1
by: Paul | last post by:
I have a class library that has a form and MDI class. My applications use this. Each application has a MDI form inherited from the MDI class. Each form that is displayed from within the MDI form...
0
by: nelis | last post by:
Anyone ever ran into the issue of adding custom properties to a user? Here's a code snippet i wrote: DirectoryEntry newUser = deContainer.Children.Add("CN=" + username, "User");...
14
by: chromis | last post by:
Hi, I've been trying to implement a more OOP oriented approach to dealing with user security on one of my websites, and I am trying to validate the user against an array of roles, however I am...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.