Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3459774
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:08:54+00:00 2026-05-18T10:08:54+00:00

I need to get visitors country information using classic asp 3.0, i’m using below

  • 0

I need to get visitors country information using classic asp 3.0, i’m using below code but it returns me XX instead of country name. any suggestions/help on this.

<%
        URL = "http://api.hostip.info/country.php?ip=" & Request.ServerVariables("REMOTE_ADDR")
        Set conn = Server.CreateObject("MSXML2.ServerXMLHTTP")
        conn.open "GET", URL, False, "", ""
        conn.send
        UserCountry = conn.ResponseText        
        Response.Write(UserCountry)

%>

i have also setup a page for view which contains the above code.

http://www.datingmaze.co.uk/rac.asp

If i try http://api.hostip.info/country.php?ip=12.215.42.19 it gives me correct output, but if i tried http://api.hostip.info/country.php?ip=119.152.136.247 gives me wrong output i.e. XX although i provided the correct IP address.

thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:08:55+00:00Added an answer on May 18, 2026 at 10:08 am

    You can use GeoIP for this.

    They have a free COM API which you can use:

    <%
    if Request.Form("values") = "Test Values" then
    hostname = "www.yahoo.com"
    else
        hostname = Request.Form("hostname")
    end if
    
    if Request.Form("submit") = "Submit" then
    
        set geoip = Server.CreateObject("GeoIPCOMEx.GeoIPEx")
    
        geoip.set_db_path("C:\Program Files\GeoIP\")
    geoip.find_by_name(hostname)
    city = geoip.city
    
        Response.Write("<table cellpadding=2 border=1><tr><th colspan=2>Results</th></tr>")
        Response.Write("<tr><td>Hostname</td><td>" + hostname + "</td></tr>")
        Response.Write("<tr><td>GeoIP City Value</td><td>" + city + "</td></tr>")
        Response.Write("</table>")
    end if
    %>
    

    http://www.maxmind.com/app/com

    http://www.maxmind.com/GeoIP-COM-1.3.zip

    Their COM API exposes the following:

    Methods:
    bool set_db_path(string path) (must be set before any other operations, true if all dbs found)
    bool find_by_addr(string ipvalue) (return true if address found, sets all properties)
    bool find_by_name(string dns_name) (-"-)
    

    The data that you would receive after lookup:

    Properties:
    country_code (2 chars; "LN" if non-routed addr, "LH" if localhost)
    country_code3 (3 chars)
    country_name ("Local Area Network" if non-routed addr,"Localhost" if localhost)
    region    (2 chars, state abbrev for US/Canada, FIPS 10-4 region code for others)
    city
    postal_code (max 6 chars, US and Canada only)
    latitude  (real number)
    longitude (real number)
    dma_code  (integer)
    area_code (integer)
    

    So instead of the using find_by_name, you would use find_by_addr. Which would lookup the country based on an IPv4-address.

    This is a better solution since relying on remote 3rd party providers can be risky. Their site might go down, be under heavy load, etc.

    You can download the free version of their IP/Country database here:

    http://www.maxmind.com/app/geolitecountry

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a php script that accepts a URL via a get request and
I need to get all controls on a form that are of type x.
I need to get the exact DataGridColumn that is associated with the DataGridColumnHeader. So,
My environment - C# 3.5 and ASP.NET 4.0 and VS 2010 Apologies - am
I need a copy of the store that is saved as Core Data sqlite
My site is to have a section for normal users, a section for managers,
I have currently created a facebook like page that pulls notifications from different tables,
Is the Visitor Pattern the fastest way to accomplish method parameter type identification (effectively
Since POST request is separate, I have to do all the stuff I already
I have two database tables (lets call them A and B) with many-to-many bridge

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.