By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,384 Members | 845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,384 IT Pros & Developers. It's quick & easy.

Get Username of a domain user

P: n/a
How can I get the domain, username and PC network name (Win 2000 Pro & Win
XP Pro PC's) of the current logged on user (logged onto a domain and access
an intranet page, Window 2000 server running IIS) and put this automatically
in a textbox in an webpage. Can this be done with asp & VB?

I basically want to automatically populate a username field with the users
logon so the do not need to type it themselves, leading to type errors.

Thanks,

Jach
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ar
Hi,

You can get domain\username into a textbox by using:

<input type="text" name="myusernamebox" value="<%=request.servervariables("LOGON_USER")%>" >

I don't think there is a server variable for the name of the client machine.....so not sure on that one.

I have a similar question that hopefully someone can help me with....

I have site running on a Windows 2000 server on my (NT4) internal domain(TESTDOMAIN). I need to be able to display certain information on the web pages based on who is accessing the site. I'm trying to use Request.ServerVariables("LOGON_USER") to show me who is logged in, but I'm having trouble with it...

If a user is already logged onto TESTDOMAIN, I don't want them to have to re-enter their login information when they try to access the site.

I have DNS set up for the site as http://mysite.mydomain.com. When I try to access the site through this hostname, the LOGON_USER variable is blank...I guess since IIS sees the user hitting the site as the IUSR_machinename anonymous account. If I access the site via http://machinename, it returns the correct domain user account. My problem is that I need to set it up using a dns host name....and if I remove anonymous access from the site, the users will be prompted for a username/password every time they hit the site.

How can I determine the user's TESTDOMAIN account name transparently when they try to access http://mysite.mydomain.com?

Thanks very much in advance for any information!
"jach" wrote:
How can I get the domain, username and PC network name (Win 2000 Pro & Win
XP Pro PC's) of the current logged on user (logged onto a domain and access
an intranet page, Window 2000 server running IIS) and put this automatically
in a textbox in an webpage. Can this be done with asp & VB?

I basically want to automatically populate a username field with the users
logon so the do not need to type it themselves, leading to type errors.

Thanks,

Jach

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.