Geolocation error with IP address 127.0.0.1

后端 未结 3 811
别跟我提以往
别跟我提以往 2021-01-07 12:58

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

It is displaying the output as:-

127.0.0.1 RESERVED ZZ

What on earth i

3条回答
  •  被撕碎了的回忆
    2021-01-07 13:32

    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.

    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.

    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.

提交回复
热议问题