Useful if your application needs to limit access based on IP address.
The key to solving the problem is the BigInteger class (System.Numerics.BigInteger), an integer of unbounded size. Once you convert your IP addresses (IPv6 or IPv4) to BigIntegers they can be quickly compared (don’t forget about endianess). The .net class IPAddress (System.Net.IPAddress) does the heavy lifting of parsing the addresses from a string for you. One thing to make note of is that you should compare like for like, don’t test an IPv4 address against an IPv6 address range.