in my application users enter the ip address + sub net mask like this: 192.168.0.0/16 or 80.80.80.0/24 and i want to validate it like this:
- if the ip address is not a valid address then return false.(its easy and
i can do it with
IPAddress.TryParse
method) - if the ip address is not a public address then return false.(192.168.0.0/16=false)
- if the sub net mask is invalid.(its not between 0 and 32).
I'm new in c# and i really appreciated if you tell me the best way to validate the ip address. thank you.