Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using this for getting ip address in array index [2] but sometime the ip address come in [1].soo there is a problem for please help me out.

string ip;
ip = System.Net.Dns.GetHostName();
IPAddress[] IpAddress = Dns.GetHostAddresses(ip);
IPHostEntry IpHost = Dns.Resolve(ip);
string ClientIp = IpAddress[2].ToString();
Posted

1 solution

Hi,

Check this link..

How to Get User IP address using c#[^]
 
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