Imports System.IO
Imports System.Net
Imports System.String
Dim strClientIP As String
strClientIP = Request.UserHostAddress()
Dim strComputerName As String
Dim host As System.Net.IPHostEntry
host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item("REMOTE_HOST"))
strComputerName = host.HostName
Dim ExternalIP As String
ExternalIP = (New WebClient()).DownloadString("http://checkip.dyndns.org/")
ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")) _
.Matches(ExternalIP)(0).ToString()
Dim FILENAME As String = Server.MapPath("IP.txt")
Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine("External IP :" & " " & ExternalIP)
objStreamWriter.WriteLine("Computer Name :" & " " & strComputerName)
objStreamWriter.WriteLine("Local IP :" & " " & strClientIP)
objStreamWriter.WriteLine("Date & Time :" & " " & DateTime.Now)
objStreamWriter.WriteLine("-----------------------------------------------------")
objStreamWriter.Close()
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents As String = objStreamReader.ReadToEnd()
objStreamReader.Close()
Imports System.Net
Imports System.String
Dim strClientIP As String
strClientIP = Request.UserHostAddress()
Dim strComputerName As String
Dim host As System.Net.IPHostEntry
host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item("REMOTE_HOST"))
strComputerName = host.HostName
Dim ExternalIP As String
ExternalIP = (New WebClient()).DownloadString("http://checkip.dyndns.org/")
ExternalIP = (New Regex("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}")) _
.Matches(ExternalIP)(0).ToString()
Dim FILENAME As String = Server.MapPath("IP.txt")
Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine("External IP :" & " " & ExternalIP)
objStreamWriter.WriteLine("Computer Name :" & " " & strComputerName)
objStreamWriter.WriteLine("Local IP :" & " " & strClientIP)
objStreamWriter.WriteLine("Date & Time :" & " " & DateTime.Now)
objStreamWriter.WriteLine("-----------------------------------------------------")
objStreamWriter.Close()
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents As String = objStreamReader.ReadToEnd()
objStreamReader.Close()
No comments:
Post a Comment