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 9277511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:07:38+00:00 2026-06-18T17:07:38+00:00

I am using this script to get User’s Client IP: <script type=text/javascript src=http://geoiplookup.wikimedia.org/></script> I

  • 0

I am using this script to get User’s Client IP:

<script type="text/javascript" src="http://geoiplookup.wikimedia.org/"></script>

I can get the IP using JavaScript as Geo.IP, but I need to get it in code behind on button click.

Something like:

protected void Button1_Click(object sender, EventArgs e)
{
    string IP = string.Empty;

    // IP = ???

    // Validation code

}

Any ideas?

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-06-18T17:07:39+00:00Added an answer on June 18, 2026 at 5:07 pm

    If you really can’t use server variables, or if you need the geo information as well as the IP, you’ll need something like the following:

    <!-- Get geo information -->
    <script type="text/javascript"
        src="http://geoiplookup.wikimedia.org/">
    </script>
    <!-- JavaScript object-to-JSON -->
    <!-- Don't actually hotlink this; host it yourself -->
    <script type="text/javascript" 
        src="https://github.com/douglascrockford/JSON-js/blob/master/json2.js">
    </script>
    <!-- Hidden field to hold result -->
    <asp:HiddenField id="hdnGeo" runat="server"></asp:HiddenField>
    <!-- Script to populate field -->
    <script type="text/javascript">
        document.getElementById('<%= hdnGeo.ClientID %>').value =
            JSON.stringify(Geo);
    </script>
    

    This puts the JSON equivalent of the Geo object in your geoiplookup reference

    {"city":"London","country":"GB","lat":"51.514198","lon":"-0.093100",
     "IP":"193.129.26.250","netmask":"24"}
    

    into an ASP.NET hidden field.

    Then, on the server, you can access it like:

    protected void Button1_Click(object sender, EventArgs e)
    {
        string json = hdnGeo.Value;
        var dictionary = new JavaScriptSerializer()
            .Deserialize<Dictionary<string, string>>(json);
        string city = dictionary["city"];
        string lat = dictionary["lat"];
        string lon = dictionary["lon"];
        string IP = dictionary["IP"];
        string netmask = dictionary["netmask"];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using this widget to get my users to create accounts: <iframe src=http://www.facebook.com/plugins/registration.php?
I'm using this java script library to show ratings http://www.fyneworks.com/jquery/star-rating/#tab-Overview . I'm using below
I'm using this script to get all the messages from a gmail account: #!/usr/bin/perl
Using this code with simplehtmldom script ( http://simplehtmldom.sourceforge.net/manual.htm ): function file_get_html() { $dom =
I am using this code to get the response: <fb:like layout=button_count notify=true colorscheme=dark href=http://www.fbrell.com></fb:like>
I'm using this small script to define if the user've scrolled to the bottom
I'm using Quest snapin to get users from active directory. This script displays date
I'm using this JS code to know what browser is user using for. <script>
I am trying to get this simple script to work. Basically, when a user
I am trying to geht this script to run: http://dysinger.net/2008/10/13/using-amazon-ec2-metadata-as-a-simple-dns but dosnt work because

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.