KNOW MI WAN IP WITH C#

  • Thread starter Thread starter Soussan Mikael
  • Start date Start date
S

Soussan Mikael

Hello evrybody,

I have to implement a simple module that can retrieve my own ip adress but
if i am behind a firewall i have to get my wan ip that's to say my external
ip adress!!!

I don't know how to do this!!!I see a little at WMI but anything.
My dns client updater can see my external ip, but if i launch ipconfig i see
only my lan 192.168.1.3)

Thank for helping!!
 
There is really no way to do that reliably using your local system as the
only point of query. Once IP packet leaves your system it can get translated
and changed any number of times without your system's knowledge, that is hte
whole point of NAT.

If your firewall is local to your PC, you can query the firewall
configuration to determine external IP address, however, if firewall is a
different system - the only truly reliable way to determine translated IP
address is to query a remote system outside your firewall for it to report
which IP address you APPEAR to be coming from.
 
that's to say i have to implement a server located on the web and to ask him
for my ip adress???
How czn I do in C# to ask various websites that print my ipadress?
 
You may create a webservice that'll return client's IP and use "wsdl"
command to generate proper C# class for you if you want.

Or create a plain ASP/ASP.NET page that'll return client's IP, and use
webclient class to read it.

There're many ways to implement it.
 
Back
Top