chrisryhal
asked on
Get Domain UserName On InTRAnet
I am trying to just gather the domain users login name when they access our Intranet on a simple little "Web User Control"
I have tried
lblUserName.Text = Request.ServerVariables("L OGON_USER" )
And nothing happens. I have tried using the SYSTEM.ENVIRNONMENT.USERNA ME and that only gives me the NETWORK SERVICE which is to be expected. This has GOT to be a simple deal.
I have tried
lblUserName.Text = Request.ServerVariables("L
And nothing happens. I have tried using the SYSTEM.ENVIRNONMENT.USERNA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
since you have windows authentication enabled, make sure you have your web.config set to force authentication;
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Both Good Articles. Thanks for hte help in resolving this.
lblLabel.Text = Environment.UserName
or
lblLabel.Text = User.Identity.Name;
How is your IIS configured ?
What you can do it, enable the Windows authentication from the Web.config file and look at the "AUTH_USER" server variable. May be this will help you.