views:

968

answers:

2

I'm working on a simple ASP.Net page (handler, actually) where I check the value of the LOGON_USER server variable. This works using Visual Studio's built-in web server and it works in other sites deployed to the live intranet site. But it doesn't work on the IIS instance on my local XP machine. How can I fix it, or what's going on if I can't?

+2  A: 

What authentication do you have enabled in IIS? Anonmyous, Basic, Digest, Integrated Windows? Sounds to me like anonymous access is enabled/allowed, and nothing else. This would means that LOGON_USER is not populated.

When you access your local IIS, trying using http://127.0.0.1 in particular if you use IE. IE will recognize "localhost" as being in your local trusted zone and will automatically pass your XP login credentials through when Integrated Windows auth is enabled.

Jon
That did the trick. It seems odd that it worked by default for Visual Studio's built in web server, though.
Joel Coehoorn
I cannot definitively tell you why. I can only say that WebDev.WebServer.exe is meant to be a a stripped down HTTP server. It doesn't offer all of the same authentication options, etc. So it wouldn't surprise me that it uses integrated auth only. What about if you use firefox, same result?
Jon
Firefox is setup as my default testing browser in VS
Joel Coehoorn
A: 

In addition to Jon's answer, IIRC even if you have Integrated Authentication enabled, if Anonymous Authentication is enabled it will take precedence...

CJM