如何根据国家IP编程不同的欢迎页面? [英] How to program different welcome pages based on country IP?

查看:84
本文介绍了如何根据国家IP编程不同的欢迎页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据IP的国家/地区创建不同的目标网页?例如,来自美国的人应该到达第1页,西班牙人应该到达第2页。

How can I create different landing pages based on the country of the IP? For example, people from USA should get landing page 1 and people from Spain should get landing page 2.

推荐答案

使用 http://freegeoip.net/json/64.34.119.12 64.34.119.12 是ip地址,你不仅有国家,而且还有这些字段:

use http://freegeoip.net/json/64.34.119.12 64.34.119.12 being ip address, you will have not only country but also those field:

    public string ip { get; set; }
    public string country_code { get; set; }
    public string country_name { get; set; }
    public string region_code { get; set; }
    public string region_name { get; set; }
    public string metrocode { get; set; }
    public string city { get; set; }
    public string zipcode { get; set; }
    public string latitude { get; set; }
    public string longitude { get; set; }

这篇关于如何根据国家IP编程不同的欢迎页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆