Wednesday, July 20, 2011

Get ip code in vb and asp .net

vb.net


Dim sam As String 'System.Net.IPAddress
        'Dim comp As Object
        'Dim rtn As Boolean

        Dim sam1 As String
        With System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName())
            sam = .AddressList(0).ToString
            MsgBox(sam)
            sam1 = sam.ToString
        End With

asp.net

  Dim a As String
        Dim i As System.Net.IPHostEntry
        a = System.Net.Dns.GetHostName
        i = System.Net.Dns.GetHostEntry(a)
        Response.Write("The Name of Host is :" + i.HostName)
        Response.Write("----")
        For Each b As System.Net.IPAddress In i.AddressList
            Response.Write("The Ip Address of Host is" + b.ToString)
        Next

1 comment: