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?

If i change IP String to "2400:3C00:3FFE:1000:1000:5EFE:8999:48AA" its working properly.

Ok, the reason why it does that is that the 0:5eFE in the 5/6 spots indicates that this is an Intrasite Automatic Tunnel Addressing Protocol (ISATAP) Address (Tunneling IPv6 traffic on an IPv4 network).

That is the correct format for an ISATAP address, you'll just have to deal with the two formats.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.