Quantcast
Channel: Classic ASP
Viewing all articles
Browse latest Browse all 488

Trying to query LDAP from ASP Classic

$
0
0

I found a blog post which I found quite useful (in theory) for a utility that I manage at work. Here is that blog post:  (this forum wouldn't let me post a link... it's titled "Hey, Scripting Guy! Who Are You?")

The Tools that I manage are written in HTML/JS and just make people more efficient at documenting their interactions.  Because the code blocks of this article weren't labeled... and I was unfamiliar with this language.... I had to do some research to find out that it was in VBScript.  Therefore, I started to figure out that I needed to create an ASP classic version of these same functions.  However, every time I call the file from AJAX, I get error 500.  Can someone please review my code to see if I'm doing something wrong?
Code Preface:  there's a file that I'm adding into my code to help me return a JSON variable easily. Here is the file and documentation:  (this forum wouldn't let me post a link... it's on GitHub and it's titledaspJSON )

Code:

<!DOCTYPE html><html><head><title>Employee Demographics</title><!--#include file="jsonObject.class.asp" --></head><body><%Session.LCID=1033Dim username, JSON, objUser
username = Request.QueryString
'where username is of the format:
'CN=(5digit#),OU=!UserAccounts,DC=(2ltr),DC=(4ltr),DC=(3ltr)

Set JSON = New JSONobject
Set objUser = GetObject("LDAP://" & username)

JSON.Add "empNum", objUser.sAMAccountName
JSON.Add "fName", objUser.givenName
JSON.Add "lName", objUser.sn
JSON.Add "fullName", objUser.displayName
JSON.Add "ext", objUser.telephoneNumber
JSON.Add "title", objUser.title
JSON.Write()
Session.Abandon
%></body></html>

This code is being called via AJAX and the AJAX is just pulling back the response.  What is wrong with my code?


Viewing all articles
Browse latest Browse all 488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>