TechnicallyChris.com

Technical and Personal Ramblings of a Bostonian
  • Home
  • About Chris
  • Donate
  • Contact Chris
Home > ColdFusion > Getting NTLM Info in ColdFusion with Anonymous Access On

Getting NTLM Info in ColdFusion with Anonymous Access On

September 12th, 2006
Goto comments Leave a comment

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.

If you enjoyed this article or it helped you in any way, I’d appreciate it if you’d post a comment below to let me know. All code examples are for demonstration only and should be used at your own risk. I cannot accept liability for unexpected results.

Chris ColdFusion ColdFusion

Comments (2) Trackbacks (0) Leave a comment Trackback
  1. christopher
    September 23rd, 2006 at 15:31 | #1
    Reply | Quote

    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.

  2. sam
    April 15th, 2008 at 10:29 | #2
    Reply | Quote

    thanks for the NTLM tip very simple and effective –

  1. No trackbacks yet.
Subscribe to comments feed
Subversion: Push Your CFML to Production on Commit The cfQuickDocs Plugin Updated
RSS feed
  • Google
  • Youdao
  • Xian Guo
  • Zhua Xia
  • My Yahoo!
  • newsgator
  • Bloglines
  • iNezha

Sponsored By

Read my review of Mozy here.

Recent Posts

  • Just Bought the Google Nexus One
  • Seven Things I’ve Liked About Windows 7 in Seven Day
  • What’s Happened to Customer Service (Part 2)?
  • What’s Happened to Customer Service (Part 1)?
  • Capturing S.M.A.R.T. Hard Disk Data from WMI with AutoIt
  • Adjusting DCOM Settings via Script
  • How to Manually Call the Google Cache
  • RoboForm & RoboForm2Go Product Review
  • Updated PingCell Function for Excel
  • Creating Hyperlinks in Word and Excel Longer than 256 Characters

Categories

  • ColdFusion
  • Firefox
  • Google Nexus One
  • IIS
  • McAfee EE / SafeBoot
  • Microsoft Windows
  • Oracle
  • Random Code
  • Random Technology
  • Sports and Recreation
  • Subversion
  • The Untechnological

Archives

  • January 2010
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • October 2007
  • September 2007
  • August 2007
  • January 2007
  • November 2006
  • October 2006
  • September 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006

Meta

  • Register
  • Log in
PageRank
Top WordPress
Copyright © 2006-2010 TechnicallyChris.com
Theme by mg12. Valid XHTML 1.1 and CSS 3.