All Forums >> [Scripting] >> ASP >> Getting Active Directory info into ASP Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I'm working with an application that currently allows users to log in, validate themselves via username and password located in a database and then change user-specific details.
I have windows machines on my network. Is there a way to pull windows active directory information using ASP? Specifically, I want ASP to retrieve a client's network user-name.
The idea is to have the user's network name captured by ASP and then the database can searched using the client's user-name.
I know that it's kinda crazy, but what would life be without experimentation?
Hi, You can use Request.ServerVariables("REMOTE_USER") to capture the Active user ID of the currently logged in user. It will come with the domain name which you'd have to strip off. Hope it helps! D
Here's what I came up with... This isn't the complete code, but it is the section I was having trouble with.
Request.ServerVariables("REMOTE_USER") should work too, but this value seems to be nulled when IIS is set to "Anonymous Authentification" Mode. I guess I just played it safe.
In addition to this, I turned Anonymous Authentification off and turned Windows Authentification on in IIS for the pages that used this code.
It works fine right now except for people who don't have their emails configured properly either in Active Directory or the SQL Database.