url:http://lite.ip2location.com/
Use the code below to convert the IP address of your web visitors and lookup for their geographical location, e.g. country , state, city, Latitude/longitude, zips, timezone and so on. Free database can is downloaded at http://lite.ip2location.com.
Expand | Embed | Plain Text
- <summary>
- Convert IPV6 Address to IP number
- Free geolocation database can is downloaded at:
- http://lite.ip2location.com/
- </summary>
- String StrIP = "2404:6800:4001:805::1006";
- System. Net. IPAddress address;
- System. Numerics. BigInteger ipnum;
- If (System. Net. IPAddress. TryParse(StrIP, out address)) {
- BYTE[] addrbytes = address. Getaddressbytes();
- If (System. Bitconverter. Islittleendian) {
- System. collections. Generic. List<byte> Bytelist = new System. Collections. Generic. List<byte>(addrbytes);
- Bytelist. Reverse();
- Addrbytes = bytelist. ToArray();
- }
- If (addrbytes. Length > 8) {
- IPv6
- Ipnum = System. Bitconverter. ToUInt64(addrbytes, 8);
- Ipnum <<= ;
- Ipnum + = System. Bitconverter. ToUInt64(addrbytes, 0);
- } Else {
- IPv4
- Ipnum = System. Bitconverter. ToUInt32(addrbytes, 0);
- }
- }
Convert IPv6 Address to IP numbers (C #)