Link to home
Start Free TrialLog in
Avatar of sypher1987
sypher1987

asked on

Getting the current users login name in IIS7

I have a web project which has been running on an IIS6 server for some time with no issues but i now need to migrate it over to IIS7 and i am having an issue which i cant seem to figure out.

The project uses active directory to authenticate users and to do this it gets the currently logged in user with 'LoginUser = new ProjectIdentity(Request.LogonUserIdentity.Name);'. This has been working fine on IIS6 but as soon as i have moved over to IIS7 the 'Request.LogonUserIdentity.Name' is only returning 'NT AUTHORITY\IUSR' every single time, whereas on IIS6 it would return DOMAIN\USER as expected.

Can anyone shed any light on the issue?
ASKER CERTIFIED SOLUTION
Avatar of somnatic
somnatic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Are you using the ASP.NET login control or a custom build one?
 - If it is a ASP.NET control, use the control's property (username or password), for instance in C#:
         string username = LoginControlID.username;
 - If it is a custom built login, simply reference the username box, for instance;
        string username = txtUsernameID.Text;
IIS 7.0: Configure Windows Authentication
http://technet.microsoft.com/en-us/library/cc754628.aspx