Click here to Skip to main content
16,012,061 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
my code is below:
C#
string myHost = System.Net.Dns.GetHostName();
            System.Net.IPHostEntry myIPs = System.Net.Dns.GetHostEntry(myHost);
            foreach (System.Net.IPAddress myIP in myIPs.AddressList)
            {
                TextBox1.Text = myIP.ToString();
            }

please help me.....
Thanks in advance.
Posted
Updated 7-Feb-12 0:54am
v2

1 solution

Well, no. What did you expect? When you run that on the server, it will return the local address of the server - i.e. it's network address on the LAN, rather than it's address on the internet. The DNS server will be the local router or whatever.
 
Share this answer
 
Comments
vivekx2 7-Feb-12 6:56am    
I need to get IPaddress from worldwide or internet.Server located in my side.local router DNS server.
OriginalGriff 7-Feb-12 7:07am    
If all you want is the Client IP address:
lbdata.Text = Request.ServerVariables["REMOTE_ADDR"];

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900