I have a ASP.NET website that requires my App Pool be the Classic .Net App Pool. The site is running on .NET 3.5 on IIS 7. When I try to get the Active Directory User name o
First of all put this lines inside web.config configuration section:
<authentication mode="Windows"/>
<authorization>
<deny users="?"/>
</authorization>
<identity impersonate="true"/>
Second go to IIS manager open your web app properties and check following settings for Authentication:
Anonymous Authentication = Disabled, ASP.NET Impersonation = Enabled (this is not realy required), Windows Authentication = Enabled
This settings will give you Active Directory User and also impersonate it.
If the same code is being used and it works in one application pool and not the other, I would check the application pool's settings. Look for the Identity attribute. I imagine, under the .NET 4.0 pool, you'll have ApplicationPoolIdentity and under the 3.5, you have a hard coded account.
Edit
So it sounds like you aren't really getting the users credentials. Of course you get the Domain account when you run locally....the process is running under you credentials. But when you run on another machine, it is running under the credentials of the account that processes the request...until you tell it to impersonate the user. And even then, you may have to set up Windows Authentication for the site to grab the credentials or use forms authentication with an AD hook to get everything under the current user account.