Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple ASP LDAP Email query

Status
Not open for further replies.
Joined
Jan 27, 2003
Messages
9
Location
US
The following code was posted by Summersl near the bottom of thread774-356151 and returns the users Name and Email Address. I got this code to work right away without having to prompt for username / password or enabling Integrated Windows Authentication or changing other security settings. My question is, is there a downside to using this code compared to the standard ADODB.Connection methods that are posted everywhere else.

<%@ Language=VBScript %>
<%
Option Explicit
Dim objSysInfo, adsUser, User, Email
%>
<html>
<head>
</head>
<body>
<%
Set objSysInfo = CreateObject("ADSystemInfo")
Set adsUser = GetObject("LDAP://" & objSysInfo.username)
User=adsUser.CN
Email=adsUser.EmailAddress

Response.write User&"<br>"
Response.write Email&"<br>"

%>
</body>
</html>
 
Actually I found out that the AD field EmailAddress doesn't always exist so it's better to use the field Mail. So the 14th line of the code should read:

email=adsUser.mail
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top