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?
BarnumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ivan_vaguninCommented:
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)
0
BarnumAuthor Commented:
i am already using this.
0
Dustin HopkinsSenior Web DeveloperCommented:
Have you enabled windows authentication for the site in IIS 7? You do this by clicking the authentication icon for your website/application's container in IIS manager. and enabling "windows authentication" and probably disable anonymous authentication.

Hope this helps,
Dustin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

BarnumAuthor Commented:
Yes, I already did this.
0
Dustin HopkinsSenior Web DeveloperCommented:
Ok to wrap this up, on the server you have:
Enabled Windows authentication
Disabled Anonymous Authentication
The server is on the same domain as the connecting computer

In your application:
Turn off Impersonation, unless you are actually using this.
And you have set the following in the web config:
<authentication mode="Windows" />
<authorization>
   <deny users="?"/>
</authorization>
The authorization section forces the client to authenticate.

After double checking this are you still getting a blank user instance?

Hope this helps,
Dustin

0
BarnumAuthor Commented:
I tried above solution.
Still not working for me.
0
BarnumAuthor Commented:
We settled on a different method of authentication.  Thanks for all the the help, though!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.