Saturday, March 10, 2012

clients public ip address in asp.net (C#)

Generally web developers need clients public ip address to store the ip in the DataBase when loging the client for some perticular security reasons. So here is the simple way to get Clients public IP address...

        WebClient webClient = new WebClient();
        string ipAddress = webClient.DownloadString("http://myip.ozymo.com/");


For the WebClient we need the namespace as using System.Net;

I hope this is the simple way to get the IP.

No comments:

Post a Comment