Hi nauna,
Please refer the sample below.
Html
<asp:GridView ID="gvLocation" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Geoplugin_Request" HeaderText="IP Address" />
<asp:BoundField DataField="Geoplugin_CountryName" HeaderText="Country Name" />
<asp:BoundField DataField="Geoplugin_CountryCode" HeaderText="Country Code" />
<asp:BoundField DataField="Geoplugin_CurrencyCode" HeaderText="Currency Code" />
</Columns>
</asp:GridView>
NameSpaces
C#
using System.Web.Script.Serialization;
using System.Activities;
using System.Net;
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string ipAddress = "103.86.39.57";
string url = string.Format("http://www.geoplugin.net/json.gp?ip={0}", ipAddress);
using (WebClient client = new WebClient())
{
string json = client.DownloadString(url);
Location location = new JavaScriptSerializer().Deserialize<Location>(json);
List<Location> locations = new List<Location>();
locations.Add(location);
gvLocation.DataSource = locations;
gvLocation.DataBind();
}
}
public class Location
{
public string Geoplugin_Request { get; set; }
public string Geoplugin_CountryName { get; set; }
public string Geoplugin_CountryCode { get; set; }
public string Geoplugin_CurrencyCode { get; set; }
}
Screenshot