Not getting IP Address due to firewall - ip

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"];

Related

access local server from other networks

I created a localhost server using servlets.
I want to know how to access from other networks(other ip addresses).
what to do for that?
any answers will be helpful for me
you should use public ip address,instead of local ip address to access over the networks.
You can access it by giving IP address of your machine in your application url in place of localhost while accessing it from another machine in the same network.
you can use your ip address instead of localhost.and also need to configure firewall.The firewall can be configured by: choosing the Windows Firewall from the Control Panel, then click on Exceptions -> Add Port and enter name and number: your server, port and leave transport protocol as TCP.
e.g,
http://10.4.0.198:8080/project

Numeric IP address of a website

I am trying to get the IP address which loads a certain website. For example; www.smmadmin.com - I tried http://192.185.77.222/ but that shows 404 page, the IP address is given by getip.com
How does this thing work? and how to get the actual IP address?
You can simply try ping command if you are on Windows.
ping www.smmadmin.com
Let me know if it doesn't work

get client ip and client location in symfony2

I need the client IP address to find the client location so that I could list the details of that area to he client. I used this code to find the IP address.
$this->container->get('request')->getClientIp();
But I'm getting the IP as 127.0.0.1.
How can I get the client IP address? Can someone give me a complete working code?
It's 127.0.0.1 because your server is installed on your machine (I guess).
But $request->getClientIp() is the right way to get the user ip.
For the geolocation, I suggest you to take a look at the geocoder library and his bundle.

How to get the domain name from an ipaddress

I want to resolve a IP address to a domain name but I don't get the desired result.
I want to retrieve the real web name something like this "google.com" from the ip address "74.125.225.100" but what I get is "ord08s08-in-f4.1e100.net"
I tried using whois and the traceroute commands in linux.
There is no unique relation beetween an ip and a domain name.
What you get with traceroute is a computer name.
But one computer may host dozens of domains.
you can use nslookup command in linux.
using nslookup <ip address> you can resolve the domain name of the IP address.
this is the link to a similar post.
http://whois.net/domain-name-ip-address/ This is exactly what you are searching for.

Finding the IP Address of my system on asp.net page

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

Resources