Welcome aboard! We are happy you are here and wish you good net-raft!
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="myfile.vb" Inherits="myfile" %>
<!-- code section -->
<script runat="server">
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Response.Write(GetLocation())
End Sub
</script>
<html>
<head>
</head>
<body>
</body>
</html>
// myfile.vb
Partial Public Class myfile
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Public Function GetLocation() As String
Dim wc as New System.Net.WebClient
Dim myip as String = wc.DownloadString("https://l2.io/ip")
Dim mycountry as String = wc.DownloadString("http://freegeoip.net/json/" + myip)
Dim jss As New JavaScriptSerializer()
Dim dict As Dictionary(Of String, String) = jss.Deserialize(Of Dictionary(Of String, String))(mycountry)
Dim s As string = "country: " &dict("country_name") & "</br>city: " & dict("city") & "</br>region: " & dict("region_name")
Return s
End Function
End Class
The most helpful VB.NET solutions
get computer name vb.net VB.NET
Click to see more ...
1.3K
76
get domain name vb.netVB.NET
Click to see more ...
1.1K
71
how to get client ip address using vb.net ?VB.NET
Click to see more ...
907
63
How to get client machine name or computer name with vb.net?VB.NET
Click to see more ...
1.2K
57
array vb.netVB.NET
Click to see more ...
638
56
get client country vb.netVB.NET
Click to see more ...
560
52
get client latitude and longitude vb.netVB.NET
Click to see more ...
448
36
detect mobile vb.netVB.NET
Click to see more ...
389
23
get machine name vb.netVB.NET
Click to see more ...
364
22
detect browser vb.netVB.NET
Click to see more ...
298
16