Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to authenticate intranet users

Posted on 2003-03-11
Medium Priority
Last Modified: 2010-04-13
I need to retrieve an ADS attribute for the currently
logged on user from an asp page, to authenticate who they are.

Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
strADsPath = "LDAP://" & strUserDN
Set objADs = GetObject(strADsPath)
x = objADS.<attribute>

Returns the attribute of the anonymous internet account,
but I need to return the attribute of the ADS
authenticated user when the site is accessed via the
Thought it would be simple, but cannot find any info on
how to do this.
Creating a dll also returns the anonymous internet account attributes, as it also is generated from the same calling thread as the asp code.

Thanks in advance
Question by:VicOm
  • 2
  • 2
LVL 12

Expert Comment

ID: 8117856
As far as I know you can get the username of the currently authenticated user (assuming you've set your Intranet to require authentication) by simply retrieving the server variable LOGON_USER (e.g. Request.ServerVariables("LOGON_USER")). Assuming you've disabled Anonymous access to the Intranet then the user should already be authenticated by the time this code is called, so that should be all you need to do.

Author Comment

ID: 8121944
Unfortunately I still need to allow anonymous access which prevents me using this method.
The idea is to log an authenticated (via ADS) intranet user directly into the site, without them having to input a username/password, but force all other (anonymous) users to login through a standard web form log-in page.
LVL 12

Accepted Solution

pjknibbs earned 150 total points
ID: 8126021
I think the problem there is that IIS will just automatically pipe everyone through the anonymous account and therefore won't bother authenticating your Intranet users, which is why your method is returning the account name for the anonymous user.

All I can suggest is that you put a different entry page on the site for your authenticated Intranet users, and get the username into a session variable or something in that page.

Author Comment

ID: 8147578
I have created an exe that the users will run that extracts the authenticated user info from ADS, encrypts it and then launches the browser, passing this data along with it.
Thanks for the help.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
The article explains the process to deploy a Self-Service password reset portal I developed a few years ago. Hopefully, it will prove useful to someone.  Any comments, bug reports etc. are welcome...
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question