IP地址为127.0.0.1地理位置错误 [英] Geolocation error with IP address 127.0.0.1

查看:174
本文介绍了IP地址为127.0.0.1地理位置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,所以我想实施这个, http://ipaddressextensions.codeplex.com/

OK, so I tried implementing this, http://ipaddressextensions.codeplex.com/.

这是显示输出: -

It is displaying the output as:-

127.0.0.1 RESERVED ZZ

127.0.0.1 RESERVED ZZ

究竟什么是保留和ZZ?它应显示为:印度IN。

What on earth is this "RESERVED" and "ZZ"? It should be displayed as "INDIA IN".

IP地址是本地主机。好吧,但对于国名和国家代码?他们为什么不正确显示?我需要做什么在我的代码改变?

The IP address is of the local host. All right, but what about the country name and country code? Why won't they display correctly? What do I need to change in my code?

推荐答案

当你在家测试,服务器和用户都是一个(个人电脑)。所以,你不能指望它显示该国作为IIS中的IP地址是一个自我的地址。

When you are testing from home, both server and user are one (your PC). So you can't expect it to show the country as the IP address for IIS is a self address.

您的代码似乎是罚款。你也可以使用免费的ASP.NET主机配套网上试试您的网站。有很多像 HelioHost ,的 0000free 等。

Your code seems to be fine. Also you can use a free ASP.NET supporting host to try your website online. There are many like HelioHost, 0000free, etc.

关于你的问题的部分编辑,如果你使用的是不同版本的网站每一个国家,那么止跌 T为使用开关更好。

Regarding the edit part of your question, if you are using different versions of the site for each country then wouldn't be using a switch better.

switch(iso3166TwoLetterCode.ToUpper())
{
    case "IN" : Response.Redirect("www.mysite.in");
    case "FR" : Response.Redirect("www.mysite.fr");
    ...
    Default : Response.Redirect("www.mysite.in");
}



我觉得它看起来整洁。

I think it does look neater.

这篇关于IP地址为127.0.0.1地理位置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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