Link to home
Start Free TrialLog in
Avatar of chrisryhal
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("LOGON_USER")
And nothing happens.  I have tried using the SYSTEM.ENVIRNONMENT.USERNAME and that only gives me the NETWORK SERVICE which is to be expected.  This has GOT to be a simple deal.
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Did you try the following:
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.
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium 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
since you have windows authentication enabled, make sure you have your web.config set to force authentication;

<authentication mode="Windows" />
      <authorization>
        <deny users="?" />
      </authorization>
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 chrisryhal
chrisryhal

ASKER

Both Good Articles.   Thanks for hte help in resolving this.