I have a C# console application and want to be able to send an Email to a certain address if any IP addresses that are not local are found in the array, I am assuming I would use a If != statement but i cannot get anything to work. Any tips or help would be greatly appreciated.
System.Net.IPAddress[] addresslist = Dns.GetHostAddresses(C);
{
string IPs = "";
bool firstIP = true;
foreach (IPAddress ip in addresslist)
{
if (!firstIP)
{
IPs = IPs + ",";
}
IPs = IPs + ip;
firstIP = false;
}
addresslist.ToString();
if addresslist != { "10.1.20.99"} //example, have multiple IP's
then //..... this is where I am stuck
Aucun commentaire:
Enregistrer un commentaire