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.
This is regarding ASP.NET MVC. Let’s say I have a web site that is
Share
You can get the remote IP using
Then converting to IpAddress and then you can use this functions to convert it to long and make the compare
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.