I have an ASP page on my intranet that regular users use, as well as users who belong to a special group. I need the page to deterimine if the vistior belongs to this special group. Can VBScript/ASP do this?
Yes it can be done. The complexity depends on how you obtain the user's login.
If you allow the user to input it - no biggie, you use that to validate against the group.
If you want the app. to detect the user, then you're not going to be able to use anonymous access as your authentication method. I believe their's a FAQ or at least a thread in the ASP forum that discusses how to determine the user's login name with Basic authentication.
AFA validating against the group, you'll use ADSI - of which you can find plenty of example scripts in the MSDN. Jon Hawkins
The webserver can have any Win. OS. If it's not 2K or later, you can install the ADSI client accordingly. By default, I believe the other OS's only provide partial support for ADSI.
If you're PDC is not Win 2K w/ Active directory implemented, I believe you can still use the WinNT DS provider (assuming your PDC is NT4 Server). I dont currently have access to a NT4 domain or else I would test this, sorry.
Goto your webserver and paste this into a .vbs file, replace the domain, user & group names with valid names on your network and execute it.
Set oDomain = GetObject("WinNT://MyDomain"
Set oUser = oDomain.GetObject("User","MyUser"
Set oGroup = oDomain.GetObject("Group", "MyGroup"
WScript.Echo oGroup.IsMember(oUser.AdsPath) Jon Hawkins
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.