Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Retrieving Client Computer Name

 
Logged in as: Guest
arrSession:exec spGetSession 2,4,2393
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP.NET >> Retrieving Client Computer Name
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Retrieving Client Computer Name - 3/18/2005 3:48:56 AM   
  AntarcticAlicia

 

Posts: 2
Score: 0
Joined: 3/18/2005
From: USA
Status: offline
I attempting to retrieve the user name and client machine name of the person logged on to a computer on our intranet in ASP.NET. This is just for logging purposes. I am able to retrieve the user name easily enough via "User.Identity.Name" or "System.Security.Principal.WindowsIdentity.GetCurrent().Name", however I cannot get the CLIENT machine name. I have searched high and low and everything I have tried returns the machine name of the server. Any suggestions? Much appreciated!
 
 
Post #: 1
 
 Re: Retrieving Client Computer Name - 3/29/2005 4:56:35 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
AntarcticAlicia, I did look for a solution, but
I couldn't find one.[V]
Should this be a security issue ?
Possibly, you can try in the Command window
the "net" and the "nbtstat" commands.
You get the possible options with /? as parameter.
Good luck.

(in reply to AntarcticAlicia)
 
 
Post #: 2
 
 Re: Retrieving Client Computer Name - 3/29/2005 6:42:56 AM   
  didorno

 

Posts: 361
Score: 0
Joined: 2/12/2005
From:
Status: offline
I played a bit with the command window.
If I input "net view", then a list with computer
names active on my LAN results. With
"net view > pcnames.txt" you get the same results in
that specified file.
A script could take care for this command and
thereafter use these computer names to search for
the associated user names in the next way.

' Returns the user name of the user currently logged on
' to a remote computer. To use this script, replace
' RemoteComputer with the name of the remote computer
' you want to check.

' Script Code

strComputer = "RemoteComputer"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
Wscript.Echo objComputer.UserName
Next

' Source : The System Administration Scripting Guide,
' part of the Windows .NET Server Resource Kit.
' For more information, contact scripter@microsoft.com.


I hope you can use this idea.

< Message edited by didorno -- 7/20/2005 7:54:20 AM >

(in reply to AntarcticAlicia)
 
 
Post #: 3
 
 Re: Retrieving Client Computer Name - 3/29/2005 6:53:24 AM   
  netmarcos

 

Posts: 55
Score: 0
Joined: 12/7/2004
From: USA
Status: offline
Perhaps a WMI call to the IP address of the incoming session?


      

(in reply to AntarcticAlicia)
 
 
Post #: 4
 
 Re: Retrieving Client Computer Name - 3/30/2005 8:42:21 AM   
  AntarcticAlicia

 

Posts: 2
Score: 0
Joined: 3/18/2005
From: USA
Status: offline
I HAVE A SOLUTION! Thank you so much for the suggestions. I have not tried them yet but I plan to do so to see if they will work for me. For now I wanted let you know that I found something else that finally worked for me:

Dim host As System.Net.IPHostEntry
host = System.Net.Dns.GetHostByAddress(Request.ServerVariables.Item("REMOTE_HOST"))
strComputerName = host.HostName

I suppose I was trying to make it too difficult. Thanks for everything! ~Alicia

(in reply to AntarcticAlicia)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP.NET >> Retrieving Client Computer Name Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts