Connecting Tech Pros Worldwide Forums | Help | Site Map

Retrieving client system name using c# in asp.net aplication

Newbie
 
Join Date: Nov 2008
Posts: 2
#1: Nov 8 '08
How to retrieve the client system name using c# in asp,net application.

joedeene's Avatar
Site Addict
 
Join Date: Jul 2008
Location: US of A
Posts: 587
#2: Nov 8 '08

re: Retrieving client system name using c# in asp.net aplication


I don't think you can get the client's system name. If so, it would probably require the use of one of the HttpRequest Members. You can get some similar information using the .LoginUserIdentity property, such as the current client's user name..

joedeene
PRR PRR is offline
Moderator
 
Join Date: Dec 2007
Location: India
Posts: 702
#3: Nov 10 '08

re: Retrieving client system name using c# in asp.net aplication


try this
Expand|Select|Wrap|Line Numbers
  1. using System.Net;
  2.  
  3. //IPAddress ip = new IPAddress();
  4.        IPHostEntry host = Dns.GetHostEntry("209.85.153.104"); 
  5. //GetHostEntry("www.google.com"); 
  6.                 //GetHostEntry("192...");
  7.                 Console.WriteLine(host.HostName.ToString());
  8.  
  9.                 IPAddress[] aa = host.AddressList;
  10.                 Console.WriteLine(aa[0].ToString());
  11.  
  12.  
  13.  
Also look into
HttpRequest Class
the Request class has 2 properties u may be interested in :
UserHostName
UserHostAddress
PRR PRR is offline
Moderator
 
Join Date: Dec 2007
Location: India
Posts: 702
#4: Nov 10 '08

re: Retrieving client system name using c# in asp.net aplication


Although Dns.GetHostByAddress is obsolete .. you could try that too...Also
Dns.GetHostEntry().. doesnt seems to correctly with IPAddress ...

Compare n see ...
Expand|Select|Wrap|Line Numbers
  1. IPHostEntry host = Dns.GetHostEntry(IPAddress.Parse("192..."));// 
  2.                 //GetHostEntry("192...");
  3.                 IPHostEntry my = Dns.GetHostByAddress("192...");
  4.                 Console.WriteLine(host.HostName.ToString());
  5.  
  6.                 IPAddress[] aa = host.AddressList;
  7.                 Console.WriteLine(aa[0].ToString());
  8.  
Reply