Click here to Skip to main content
15,904,288 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to Track ip address and system name in asp.net
Posted

Have a look at this code.
C#
String ip= Server.HTMLEncode(Request.UserHostAddress);

This will give you ip as a string.

Note:

You will get 127.0.0.1 every time if you run it from localhost.

Further,refer to this link

How to get Client Machine Name in ASP.NET / C#[^]

Regards..:)
 
Share this answer
 
 
Share this answer
 
You can get the IP address of the client using the following statement:
string ipAddress = Server.HTMLEncode(Request.UserHostAddress);

There is no way to get the client's machine name. The reason is that the website has no access to a machine other then some specific folders on a machine. So, if you try to get the machine name using ASP.Net your efforts will be in vain. But yes, over the network you can get the machine name using the following statement:

string clientMachineName = (Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900