I want to get client subnet mask using c#.
How can I get it?
First of all, check NetworkInterface
class first. There are a lot of information in it. And these articles will be helpful for you:
It's impossible to know what subnet mask client's network is using (if we are talking about D and E class IP addresses).
My assumption is that by "client" you mean a remote computer connected to your server. Otherwise see @Soner Gönül answer.
来源:https://stackoverflow.com/questions/13901436/how-to-get-subnet-mask-using-net