A user asked me on the forums if it was possible to convert a domain name to an I.P. Address. The answer is quiet simple. Just use the System.Net.Dns class
C#
using System.Net;
protected void Page_Load(object sender, EventArgs e)
{
foreach (IPAddress address in
Dns.GetHostAddresses("www.devcurry.com"))
{
Response.Write(address.ToString());
}
}
VB.NET
Imports System.Net
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As EventArgs)
For Each address As IPAddress In
Dns.GetHostAddresses("www.devcurry.com")
Response.Write(address.ToString())
Next address
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment