Welcome aboard! We are happy you are here and wish you good net-raft!
// default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Class1.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div style="text-align:center">
<asp:Literal ID="idspan" runat="server"></asp:Literal>
</div>
</body>
</html>
// Class1.aspx.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Services;
using System.Web.Script.Serialization;
public partial class _Default: System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (var webClient = new System.Net.WebClient()){
var data = webClient.DownloadString("https://geoip-db.com/json");
JavaScriptSerializer jss = new JavaScriptSerializer();
var d = jss.Deserialize<dynamic>(data);
decimal latitude = d["latitude"];
decimal longitude = d["longitude"];
idspan.Text = "latitude: " + latitude " longitude: " + longitude;
}
}
}
The most helpful C# solutions
detect ie C#C# Click to see more ... 4.7K 853