Getting NTLM Info in ColdFusion with Anonymous Access On
A common question I’ve seen around is how to get a users NT login name, even when Anonymous access is turned on. As you may be aware, when both Windows Authentication and Anonymous Access are turned on, the web server doesn’t send the 401 code to the browser, and the browser doesn’t send the server the info. This means that we can’t get the data from the CGI scope.
If you need a single page to get this data, or only need to grab it if other conditions are met, you can use the little snippet of code below to send the request to the browser manually:
1 2 3 4 | <cfif cgi.http_authorization is ""> <cfheader statuscode="401" statustext=""> <cfheader name="Www-Authenticate" value="NTLM"> </cfif> |
This is going to work the same as if IIS sent them, so if IE isn’t configured to pass the information automatically, your user will be prompted for the credentials, and if they are using any other browser, they will be prompted.
As I hinted at, you could use this code to only prompt the users when other conditions are met, such as the user is on a certain browser, or is connecting from a specific IP address, etc.

Sorry, I’m not sure – but I’ve posted a few discussion boards in the bookmarks section of the site where a wider range of developers may be able to help.
thanks for the NTLM tip very simple and effective –