예제 #1
0
    protected override IpGeolocationInfo TranslateResponse(string responseJson)
    {
        FreeGeoIpResponse responseObject = JsonConvert.DeserializeObject <FreeGeoIpResponse>(responseJson);

        IpGeolocationInfo info = new IpGeolocationInfo()
        {
            Ip        = responseObject.IP,
            Latitude  = responseObject.Latitude,
            Longitude = responseObject.Longitude
        };

        return(info);
    }
예제 #2
0
        public ActionResult Index()
        {
            // IPHostGenerator gen = new IPHostGenerator();
            string ipaddress = IPHostGenerator.GetVisitorDetails();

            ipaddress = "59.94.121.148";
            //string ip = ipaddress.Split(new char[] { ':' })[1];
            FreeGeoIpResponse location = IPHostGenerator.GetLocation(ipaddress);

            return(View(location));


            //string res = "http://ipinfo.io/" + ipaddress + "/city";
            //string ipResponse = gen.IPRequestHelper(res);
        }