Request.ServerVariables["LOGON_USER"] blank when using ASP.NET wildcard application mapping

1.6k views Asked by At

When I set up wildcard application maps so that asp.net handles requests (setting executable path to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll) LOGON_USER is blank when I access a page via site.com/directory/ - site.com/directory/default.aspx returns the correct LOGON_USER value.

How can I fix this without needing to take off application maps?

Simple test:

<%# Request.ServerVariables["LOGON_USER"] %>

Results in DOMAIN\UserName when application maps not set up, but a blank string when they are.

Edit:

The site uses Forms authentication for administration, but I need to do LDAP queries based on the currently logged in user (and to search Active Directory) - anonymous access is turned off and Windows Integrated Authentication turned on.

1

There are 1 answers

2
Paul On

I've never seen that before, and I almost always wildcard map, but is there any reason you're not using Request.User (or the Page's User helper property) instead of the string-based variable? I'm not sure if that'll help, but it is at least more safe from typoes.