Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

...Request.ServerVariables("WHAT THE HECK")

Status
Not open for further replies.

OhioSteve

MIS
Joined
Mar 12, 2002
Messages
1,352
Location
US
I am working on asp.net applications that live on an intranet. I frequently use this line to get the user's name:

Dim x As String = System.Web.HttpContext.Current.Request.ServerVariables("AUTH_USER")


Now I need to get the user's workstation's name. What is the name for that server variable?
 
Try this...

Code:
Environment.MachineName

Environment can be used to get the username, domain name, etc.
 
If you add Trace="True" to your page, you'll be able to see a table for information that is available to you.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
jshurst, your suggestion led me to look at "environment..." That is pretty cool. Lot's of good stuff there.

Unfortunately, I need the user's workstation's name.
environment.machinename tells me the web server's name.
 
this is what I use:

Public Function GetMachineName() As String
Dim host As System.Net.IPHostEntry
host = System.Net.Dns.GetHostByAddress(Context.Request.ServerVariables.Item("REMOTE_HOST"))
Return host.HostName

End Function

HTH!
 
Sorry about that I hadn't actually test that as I haven't had a need for it, I do use environment.username and environment.userdomainname quite a bit. mmaz's example seems to work though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top