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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:24:53+00:00 2026-05-17T02:24:53+00:00

This is regarding ASP.NET MVC. Let’s say I have a web site that is

  • 0

This is regarding ASP.NET MVC.
Let’s say I have a web site that is accessed publicly name as “www.welcomeeveryone.com”. There is also a web site name as “www.companyemployeeonly.com” that is allowed only for certain range of IP address. Employees have to go to “www.welcomeeveryone.com” first in order to have a link for “www.companyemployeeonly.com”.
Here is my question. How do I detect the user is in the allowed IP or not and give them a warning like popup or some kind of notification. When they are not in the certain IP address, then they have to use VPN connection.

  • 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-17T02:24:53+00:00Added an answer on May 17, 2026 at 2:24 am

    You can get the remote IP using

    Request.ServerVariables["REMOTE_HOST"]
    

    Then converting to IpAddress and then you can use this functions to convert it to long and make the compare

    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;
    }
    

    Be ware that the Remore_Host is not valid if he is behind proxy, and you need to discover that, and also can be hacked.

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

Sidebar

Related Questions

We have an ASP.NET MVC website that a customer is requesting Active Directory single
I have been evaluating xVal as framework for validating Entities in the ASP.Net MVC
One of the benefits of ASP.NET MVC I keep reading about is that it's
I have 3 days to learn the basics of ASP.NET MVC and create a
I am reading this asp.net article on building your first asp.net mvc 2 website
While reading an Asp.Net MVC code sample that used MbUnit as it's testing framework,
In my ASP.NET MVC application the ASP.NET pipeline is being invoked for static files
I'm trying to decide what validation approach to take for a new ASP.NET MVC
I'm working on an ASP.NET MVC app, designing the domain models, using (testing) the
After reading ASP.NET MVC 2 in Action and watching Jimmy Bogard's presentation from MvcConf

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.