473,508 Members | 3,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get user details ASP/LDAP/WINNT

Hi,

I'm trying to get a very simple task to work. Using the users login name
(gained from IE) I want to get their full name from AD (Win 2k and 2003 AD
domain).

I'm using this ASP code on the IIS server:

usr=mid(request.ServerVariables("LOGON_USER"),8)
Set User = GetObject("WinNT://domainname/" & usr & ",user")
response.write "Name is " & User.Fullname
set usr=nothing

This code works fine when run on the server direct using wscript, but when
served by the web server I get the error:

Active Directory (0x80070005)
General access denied error

So the code is OK, but I'm obviously missing something here. I know using
LDAP queries are another way but I want to keep this very simple.

Do I need to change some permissions or is there another way to do this? The
user could be in one of several OUs in the AD.

Jul 22 '05 #1
2 9029
On Fri, 11 Mar 2005 04:33:02 -0800, A Lake
<AL***@discussions.microsoft.com> wrote:
I'm trying to get a very simple task to work. Using the users login name
(gained from IE) I want to get their full name from AD (Win 2k and 2003 AD
domain).

I'm using this ASP code on the IIS server:

usr=mid(request.ServerVariables("LOGON_USER"),8 )
Set User = GetObject("WinNT://domainname/" & usr & ",user")
response.write "Name is " & User.Fullname
set usr=nothing

This code works fine when run on the server direct using wscript, but when
served by the web server I get the error:

Active Directory (0x80070005)
General access denied error

So the code is OK, but I'm obviously missing something here. I know using
LDAP queries are another way but I want to keep this very simple.

Do I need to change some permissions or is there another way to do this? The
user could be in one of several OUs in the AD.


On the server you're running in the context of the logged in user,
likely administrator. In the web site, you're running in the context
of the anonymous user or the logged in user, likely *not*
administrator. Check permissions for whatever account you're using.

Jeff
Jul 22 '05 #2
I've checked this but I get the same error logged in as an Domain Admin
using the web browser on a remote machine

IIS is set to only allow Windows Authentication (no anonymous logins)

Is there somewhere else I should be checking?

"Jeff Cochran" <je*********@zina.com> wrote in message
news:42****************@msnews.microsoft.com...
On Fri, 11 Mar 2005 04:33:02 -0800, A Lake
<AL***@discussions.microsoft.com> wrote:
I'm trying to get a very simple task to work. Using the users login name
(gained from IE) I want to get their full name from AD (Win 2k and 2003 AD
domain).

I'm using this ASP code on the IIS server:

usr=mid(request.ServerVariables("LOGON_USER"), 8)
Set User = GetObject("WinNT://domainname/" & usr & ",user")
response.write "Name is " & User.Fullname
set usr=nothing

This code works fine when run on the server direct using wscript, but when
served by the web server I get the error:

Active Directory (0x80070005)
General access denied error

So the code is OK, but I'm obviously missing something here. I know using
LDAP queries are another way but I want to keep this very simple.

Do I need to change some permissions or is there another way to do this?
The
user could be in one of several OUs in the AD.


On the server you're running in the context of the logged in user,
likely administrator. In the web site, you're running in the context
of the anonymous user or the logged in user, likely *not*
administrator. Check permissions for whatever account you're using.

Jeff

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1362
by: RCIC | last post by:
Trying to get a user's full name using ADSI. It works in our Win2000 Active Directory but fails when I try to get a user's full name from a trusted WinNT domain. The error is "Cannot create ActiveX...
1
5186
by: elziko | last post by:
Hi, I'm using the following code to create a user: Dim strNodeName As String = "test user" Dim NewUser As DirectoryEntry Dim AD As New DirectoryEntry("WinNT://MYCOMPUTER") 'delete user...
1
2551
by: Bjorn Kristensen | last post by:
Hi. I'm trying to read all the users and user groups from the NT domain I'm connected to. I cnat't se how this should be done. Can anyone help me. I'm basically trying to link my users to the...
3
1970
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
1709
by: Lauchlan M | last post by:
Hi. I have an ASP.net project that works fine. I copied it to another project using the following steps: << (i) create a new VS.NET ASP.NET project.
1
6438
by: Ram | last post by:
Hey, I'v managed to set the "User Must Change Password At Next Logon" flag on the LDAP protocol, Using the - "pwdLastSet" property - by setting it to - "0" (for on) or - "-1" (for off). The...
1
1375
by: nate axtell | last post by:
I found the DirectoryServices in the System namespace which I believe is what I need to see if the logged in user to my VB .NET application is in a specific group in active directory. I'm not sure...
4
1996
by: Cleyton | last post by:
Hello! I need to get the user groups in a machine, because i need to verify dynamically what's the name of the group "Everyone" in different windows. For example, in windows in portuguese the...
5
13167
by: Michael Howes | last post by:
I'm writing a utility to manage a machines *local* accounts in c# I am getting all the users in a specific Group just fine but when I want to get some of the information on each user from their...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.