Link to home
Start Free TrialLog in
Avatar of Barnum
BarnumFlag for United States of America

asked on

Get Windows login in ASP.NET website on IIS 7

In my asp.net 4.0 website I am using windows login  user name to login in my website without asking credential if that windows login user is  in DB if that user not in db then asking credential and authenticate against db .
To achieve above goal I implemented form and widows authentication in my website.
When I ran website through VS 2010(Dev. environment) I get actual windows login name but if I ran website on IIS 7 then I get “IUSER” as a windows login.
Following command I am trying  
      
"HttpContext.Current.Request.LogonUserIdentity.Name" get "IUSR" (NT AUTHORITY\IUSR) on IIS 7.
      
"HttpContext.Current.User.Identity.Name"  get  empty on IIS 7.
      
How can i get actual windows login on IIS 7 as well?
Avatar of Member_6283346
Member_6283346

Hi! You need to enable impersonation in web.config:
<configuration>
  <system.web>
    <identity impersonate="true"/>
  </system.web>
</configuration>

(http://msdn.microsoft.com/en-us/library/xh507fc5.aspx)
Avatar of Barnum

ASKER

i am already using this.
ASKER CERTIFIED SOLUTION
Avatar of Dustin Hopkins
Dustin Hopkins
Flag of United States of America image

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
Avatar of Barnum

ASKER

Yes, I already did this.
SOLUTION
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
Avatar of Barnum

ASKER

I tried above solution.
Still not working for me.
Avatar of Barnum

ASKER

We settled on a different method of authentication.  Thanks for all the the help, though!