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

  • SEARCH
  • Home
  • 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 8853733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:43:21+00:00 2026-06-14T13:43:21+00:00

I’m looking to geolocate my server requests by continent. Basically, after doing some initial

  • 0

I’m looking to geolocate my server requests by continent.

Basically, after doing some initial research, it seems that there are 3 approaches: 1) using the geolocation provided by browsers (but I think noone seriously click “Yes” when the browser is asking permission to use geolocation); 2) getting a list of IP addresses, putting that list in a database on your server and then every time a request comes in, read from this DB; I’d hate to have have to hit the DB at every request. 3) make an HTTP call to an external server to get the location; that could even be slower than 2).

Basically, I don’t really care to know exactly where the users are, I just need to know which continent they’re on: North Armerica, Europe…

Is there a way to do this that doesn’t require any user interaction and doesn’t require reading a DB on every request? When I go to http://www.intel.com I get automatically rerouted to the French site; how do they do that?

Thanks for your suggestions.

  • 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-06-14T13:43:22+00:00Added an answer on June 14, 2026 at 1:43 pm

    There are some free and some commercial database that can tell you from the ip, where is coming from.

    The free database from maxmind [*]: http://dev.maxmind.com/geoip/geolite

    and two commercial:
    http://www.ip2location.com
    http://www.maxmind.com

    In this site you can also find asp.net examples on how you can use that data, but also they have other free services that you can use and see where the use is come from.

    Get api samples together with the database from: http://www.maxmind.com/download/geoip/

    If only the country is what you need for then this database file

    http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip

    contains only the country, and is small compared with the rest.

    How this works in few words: The database is in format of:

    "1.20.0.0","1.20.255.255","18087936","18153471","TH","Thailand"
    "1.21.0.0","1.21.255.255","18153472","18219007","JP","Japan"
    "1.22.0.0","1.23.255.255","18219008","18350079","IN","India"
    "1.24.0.0","1.31.255.255","18350080","18874367","CN","China" 
    

    the long numbers are the translation of the ip. So you read the IP of your user and then with a function you convert it to long and then you search the database, where is this long number fits.

    public long addrToNum(IPAddress Address)
    {
        byte[] b = BitConverter.GetBytes(Address.Address);
    
        if (b.Length == 8)
            return (long)(((long)16777216 * b[0]) + ((long)(65536 * b[1])) + ((long)(256 * b[2])) + b[3]);
        else
            return 0;
    }
    

    So if you add them in database then you index the database on this long numbers and look where the ip is in as:

    Select TOP 1 * from GeoIPCountryWhois WITH (NOLOCK) Where @myIpToLong BETWEEN begin_num AND end_num
    

    Its good to cache the result on a session variable and not search again and again on every page request.

    [*] A big thanks to maxmind that still release the free database together with the commercial.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace

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.