Using the IPAddress class with masks?

G

Grandma Wilkerson

Hi,

This is your grandmother.

I'm have a situation where I have access to an IPAddress and a mask and
need to determine if another IP address is included in the IP block
specified by former IP address and mask. The function prototype looks
something like this:

bool IsIPAddressInBlock(IPAddress neworkID,IPAddress mask,IPAddress test){
//TODO:?
}

I understand conceptually what an IP address and mask are, but I'm not
sure how to analyze the individual bits of the networkID and mask.

Granny
 
G

Grandma Wilkerson

I tried:

{
return (test.Address & mask.Address)==networkID.Address;
}

.... but I get compiler errors stating that the Address property is
"obsolete"?

Granny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top