[C#]Ver IP Publica

Iniciado por Bloc, Septiembre 07, 2013, 09:23:37 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Septiembre 07, 2013, 09:23:37 PM Ultima modificación: Mayo 27, 2014, 09:57:02 PM por Expermicid
Bueno aqui les dejo esta función que hice para ver la ip publica
OJO: No se olviden de usar : using You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login; (para la función)

Código: csharp
       public void Ver_IP_Publica(ref string sIP)
        {
           // _____________________________
           //|Función: Ver IP Publica      |
           //|Autor: Bloc                  |
           //|Fecha Publicada: 07/09/2013  |
           //|Requisitos: Dejar fuente     |
           //|Uso: string sIP = null;      |
           //|     Ver_Ip_Publica(ref sIP) |
           //|Nota: Usamos:                |
           //|      using System.Net;      |
           //|_____________________________|

            string webIP = "http://checkip.dyndns.org";
            string sDownCad,scad,scad2;
            WebClient DwnIP = new WebClient();
            sDownCad = DwnIP.DownloadString(webIP);
            char[] sborr1 = { '<', 'h','t','m','l','>','e','a','d','i','b','o','d','y','C','u','r','n',' ','I','P','c','k','/','A','s',':'};
            scad = sDownCad.TrimStart(sborr1);
            scad2 = scad.Replace("</body>", "");
            sIP = scad2.Replace("</html>", "");
        }


Si lo quieren probar solo hacen esto:

Código: csharp
MessageBox.Show(sIP);


Saludos y espero que les sirva!.
Skype: Bloc-Hack

El problema es que si cae esta web tu rutina no funciona...

acá hay otro ejemplo:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Nivel 77 You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login