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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:26:34+00:00 2026-06-03T08:26:34+00:00

I want to try testing the current ip address to find current country so

  • 0

I want to try testing the current ip address to find current country

so i try this code…
HttpContext.Current.Request.ServerVariables[“REMOTE_ADDR”];

but it is always return 127.0.0.1′

Is there any other code that i can get my ip address on internet like 61.90.25.10
instead of the local one.

  • 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-03T08:26:35+00:00Added an answer on June 3, 2026 at 8:26 am
    HttpContext.Current.Request.UserHostAddress;
    

    or

    HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
    

    To get the IP address of the machine and not the proxy use the following code

    HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
    

    But as your using this application offline you will always receive the IP address of your PC because that’s the IP the server will see in another word your not going outside your router and connecting back on the server so your external ip is not been used:

    If you test your application on running server online and try to print out:

    Response.Write("IP Address:");
    Response.Write("IP: " + HttpContext.Current.Request.UserHostAddress);
    Response.Write("IP1: " + HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
    Response.Write("IP2: " + HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
    

    You will see the public ip you have, take care if your using reverse proxy before reaching your PC like cloudflare Make sure to use the HTTP_X_FORWARDED_FOR Otherwise you can use the remote_addr or userhostaddress.

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

Sidebar

Related Questions

I want to test this view: def register(request): handle user registration code variable is
I want to try the latest VS2010 RC. But I am not very comfortable
I'm developing a network application and I want to get unit testing right. THIS
I want to try PartCover for code coverage. I'm running Visual Studio 2008 Professional
I code a FTP client Application, testing my functions by nunit tool. I try
I try to send a multi array via cURL but I can't find a
I want to try db connection to check is db available. In zend I
I want to try CMake to manage a new C++ project. However, some files
I want to try create something like Zend's Server Pagecache. What I want to
I want to try out Joda Time with Play Framework 2.0. So I have

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.