Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET IPAddress Class is converting IPv6 to Mapped IP Address

Tags:

.net

I have IPv6 string and I want to make the IPAddress object. I tried the following code

String ipString = "2400:3C00:3FFE:0000:0000:5EFE:8999:48AA";
System.Net.IPAddress address;
IPAddress.TryParse(ipString, out address);

but address.ToString() is returning the value "2400:3c00:3ffe::5efe:137.153.72.170".

Why this has been converted to mix ip?

like image 958
Anshuman Verma Avatar asked Jan 16 '26 20:01

Anshuman Verma


1 Answers

This is, AFAIK, happening on Windows 2003 + XP (maybe Vista, but I'm not sure), because of their implementation of IPv6. On newer OSes it will be ok.

like image 188
nothrow Avatar answered Jan 19 '26 20:01

nothrow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!