How to convert an Ip Address Instance[generateed by using IPAddress.Parse method] back to a IP string.
Observation:--
The ToString() method is not working..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Aug 8, 2012, 7:13 AM
However, it's not difficult to change my latest code so that it now deals with abbreviated addresses - it still prints them out in expanded form but I imagine that's not a problem:
Swapnasagar PandaPosted Aug 8, 2012, 5:41 AM
But the same IP i can write like 2001:0db8:85a3::8a2e:0370:7334
And the code fail in this case, as u r spliting : only. So the first approach is the better approach as that is a more generalised way. Apart from the O.S problem. Actually i chked the diff. also. The IPAddress.Parse() methos is behaving diff. for both the OS. Please suggest if any.
Thanx
Swapnasagar
VulpesPosted Aug 8, 2012, 4:36 AM
http://www.c-sharpcorner.com/forums/thread/182052/generating-the-next-value-of-a-valid-ipv6-format-ip-add.aspx
should work under any OS because I'm not using the IPAddress class at all.
Swapnasagar PandaPosted Aug 8, 2012, 1:36 AM
U r absolutely right. I checked in windows 7 O.S and found that the code is working properly.But can u suggest me any way, so that it ll work in every O.S.
Thanks a lot for ur help till now. Please suggest any alternative.
Swapnasagar PandaPosted Aug 8, 2012, 1:22 AM
I am using .net framework 4.0 , but os is windows xp sp3. So is there any problem with it, because in the ipv6 generation code what u ve given , there i am not getting this desired o/p.my last 32 bits are coming as ipv4 format.
VulpesPosted Aug 7, 2012, 6:31 AM
If I run this code:
then the output is:
If you're seeing something different, then it could conceivably be an OS or .NET version problem. I'm using Windows 7 and .NET 4.0.