njgroup
asked on
how to get ip address location in asp.net c# .net
hi,
I have returned an host ip address from:
so I wanna detect the location of that ip address, such as USA, NY, New York City
how can I do that in asp.net?
I have returned an host ip address from:
so I wanna detect the location of that ip address, such as USA, NY, New York City
how can I do that in asp.net?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks, but that doesn't help,
that works for get method, but not post!
how will I specify the IP address in post method?
that works for get method, but not post!
how will I specify the IP address in post method?
ASKER
I mean that returns whole page!
in post method, how to specify parameter and get string of location only?
in post method, how to specify parameter and get string of location only?
hi,
protected void chkIPAddress_Click(object sender, EventArgs e)
{
string hostName = Dns.GetHostName();
Console.WriteLine("Host Name = " + hostName);
IPHostEntry local = Dns.GetHostByName(hostName );
foreach (IPAddress ipaddress in local.AddressList)
{
Console.WriteLine("IPAddre ss = " + ipaddress.ToString());
result = result + ipaddress.ToString();
}
txtBrowser.Text = result ;
}
http://www.codeproject.com/KB/IP/obafindingipinformation.aspx
protected void chkIPAddress_Click(object sender, EventArgs e)
{
string hostName = Dns.GetHostName();
Console.WriteLine("Host Name = " + hostName);
IPHostEntry local = Dns.GetHostByName(hostName
foreach (IPAddress ipaddress in local.AddressList)
{
Console.WriteLine("IPAddre
result = result + ipaddress.ToString();
}
txtBrowser.Text = result ;
}
http://www.codeproject.com/KB/IP/obafindingipinformation.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that's great, but do u have a db for cities free?
ASKER
I wanna get the result in page load method instead of posting a form, isn't there any way to get a result in page load method?
protected void Page_Load(object sender, EventArgs e)
{
// code to get location of remote host ip
}