c# – Website IP address

Question:

Hello to all. How to get the port of the site by the site address and display it in a text field in C#?

Answer:

List of ip addresses from dns:

System.Net.Dns.GetHostEntry("www.yandex.ru").AddressList

I think you can guess how to pull it out of the collection and shove it into the textbox.

To pull out the port from the address, I think you also think of it? You can explore and use the Uri class:

new Uri("http://www.yandex.ru:9000").Port
Scroll to Top