Ok, it's friday afternoon, and i've had a long week so would appreciate some help! Currently, i have a list of IP ranges, as follows:
List<IPRange> ipRanges = new List<IPRange>();
ipRanges.Add(new IPRange { From = "145.36.0.0", To = "145.36.255.255" });
ipRanges.Add(new IPRange { From = "194.183.227.184", To = "194.183.227.191" });
ipRanges.Add(new IPRange { From = "193.131.192.0", To = "193.131.223.255" });
After getting the IP of the client, if it falls anywhere between these sets of ranges, they need to be redirected elsewhere.
For example,
If someone visited the site with the IP 192.168.0.1
, they would be allowed access.
If they visited with 145.36.1.0
, they would not be allowed access because it falls between the first range in that list.
I could split each IP by the period, and work out where the range starts to change, then do a comparison, but that would be heavy on the server.
I know IP's are basically just decimal numbers, but am not really sure how that works.
Has anyone come across this before?
Cheers, Sean.