Getting website IP in .NET

First add 2 textbox

textbox1 over textbox2

go on properties of textbox2 and set readonly to true

and a button.. name it get or get ip

your choice :cool:

now paste the following codes



Code:



Code:
Imports System.Net

Public Class Form3





    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

        Try

            If TextBox1.Text.Contains("http://") Then

                Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text.Replace("http://", String.Empty))

                TextBox2.Text = iphe.AddressList(0).ToString()

            Else

                Dim iphe As IPHostEntry = Dns.GetHostEntry(TextBox1.Text)

                TextBox2.Text = iphe.AddressList(0).ToString()

            End If

        Catch ex As Exception

            MsgBox(ex)

        End Try

    End Sub



End Class
Share on Google Plus

About Unknown

Hey there I'm Shahid Ayan Khan The Founder Owner Of This Blog.I don't Mind Being Called A CEO.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment