I need my system IP address. I've used Request.ServerVariables["remote_addr"] but it is being provided IP address of my network(intranet) not my local system ip.
Actually I've set session state off and want to identify the user request. So i want to fetch the system IP not router/network IP.
Please tell me the appropriate solutions.
Request.UserHostAddress.
Try this.
try this
how to get ip address of machine in c#
You should be able to use:
Request.ServerVariables["LOCAL_ADDR"]
As seen on: http://msdn.microsoft.com/en-us/library/ms524602(VS.90).aspx
Related
The user is reporting the issue has an IP address of 10.10.15.67/20. The server has an IP address of 10.10.16.1/20. The user's machine has an IP address of 10.10.25.197/20. Can anyone explain to me based on this why he can't get to the file? This users has full permissions.
The first IP address belongs to network 10.10.15. The other two, to 10.19.16.
Do the first machine not being in the same subnet cannot talk to the two others. Use ping to confirm that.
You can use the subnet calculator here: https://www.calculator.net/ip-subnet-calculator.html
Ours is a small network consisting of 15 users. We have LAN messenger installed in every machine. Someone is misusing it by using anonymous IP address in their system. We traced the anonymous IP as 192.168.0.155. Now we want to check each system if they have manually changed their IP to the above address. Does Windows stores IP address change event anywhere? All are static IP within a LAN.
With some luck, I've got an easy solution for you to retrieve some information about the target. You could try to use the nbtstat-command.
Just open a command prompt and type in the following:
nbtstat -A 192.168.0.155
This will output a bunch of information about the target host, including the machinename and MAC address.
Here is an example, how the output could look like:
(source: onlinecomputertips.com)
Good luck
i am trying to implement personalization in my website using the IP address. but because of firewall i'am no able to get the user's original ip address. I tried following lines of code
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
HttpContext.Current.Request.ServerVariables["HTTP_CLIENT_IP"].ToString();
Please try these two
Request.ServerVariables("REMOTE_ADDR")
or
Request.UserHostAddress
To get the IP address of the machine and not the proxy use the following code
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
How can we know our own EXTERNAL IP address on the CLIENT (=our computer); NOT our internal IP address, NOT through an existing web site, NOT through a new website we would fabricate for this question; JUST with pure client OS commands scripting and/or JavaScript? Is that possible? In fact, if someone as a way to do that they should collect 1 million dollars because nobody has EVER come up with an answer to that on ANY website on this planet to my knowledge, A.R.
I think somebody DID ask that already, but using C#
IPHostEntry host;
string localIP = "?";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
}
}
return localIP;
I don't know the OS you're targeting, but you might create an console application and read the value from it
Hope it helps
As Gricha mentioned, it can be requested via external site. There is an open source project that is also hosted.
You can get your external IP info in JSON format by calling this API:
curl http://ip2country.sourceforge.net/ip2c.php?format=JSON
in C#, there must be a similar method to call web API.
The project info is here: http://code.google.com/p/ip-address/
You can't find an external ip address from a simple system call. You can receive it from the router, which is probably router specific, or you need to make a call from an something out side of your lan. Typically this is done through a HTTP request or some other popular internet service.
Also, individual computers on a local network don't have an external ip. The router has one address and forwards packets to the individual device.
You can't do that without going out of your current network.
To know your IP address you need to ask your router about. It's your router that gives you the IP in his network.
To know the IP address that belongs to your router in their network - you need to ask someone in that network about your IP. Because that network gives him an IP.
Finally if you want to know your IP outside your ISP's network - you need to ask someone outside your ISP's network about it.
i need to find the remote users ip address using asp.net and also i need clarification whether multiusers have same ip address
thanks
Shakthi
Dim userIP As string = Request.UserHostAddress
Edit Caveat - the below is talking about an internet scenario. On a more limited (intranet) network, you may be able to assume a 1-1 User-IP Address mapping
Multiple users may appear to have the same IP address.
The same user may make two requests in a row from different IP addresses.
Whatever you're trying to do, using the users IP address for anything other than logging is probably pointless.