+2  A: 

It looks like this will do what you want:

ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI",
"SELECT * FROM MSNdis_80211_ServiceSetIdentifier");


foreach (ManagementObject queryObj in searcher.Get())
{
    Console.WriteLine("-----------------------------------");
    Console.WriteLine("MSNdis_80211_ServiceSetIdentifier instance");
    Console.WriteLine("-----------------------------------");

    if(queryObj["Ndis80211SsId"] == null)
        Console.WriteLine("Ndis80211SsId: {0}",queryObj["Ndis80211SsId"]);
    else
    {
        Byte[] arrNdis80211SsId = (Byte[])
        (queryObj["Ndis80211SsId"]);
        foreach (Byte arrValue in arrNdis80211SsId)
        {
            Console.WriteLine("Ndis80211SsId: {0}", arrValue);
        }
    }
}

from http://bytes.com/groups/net-c/657473-wmi-wifi-discovery

amdfan
Thanks for the answer. Unfortunately this method is not working with Windows Vista.Do you have any other idea?
mariosangiorgio
A: 

You are going to have to use native WLAN API. There is a long discussion about it here. Apparently this is what Managed Wifi API uses, so it will be easier for you to use it if you do not have any restrictions to use LGPL code.

Recep
That is what I did. It revealed to be easy. Thanks for your answer.
mariosangiorgio
+2  A: 

I resolved using the library. It resulted to be quite easy to work with the classes provided:

First I had to create a WlanClient obhect

wlan = new WlanClient();

And then I can get the list of the SSIDs the PC is connected to with this code:

Collection<String> connectedSsids = new Collection<string>();

        foreach (WlanClient.WlanInterface wlanInterface in wlan.Interfaces)
        {
            Wlan.Dot11Ssid ssid = wlanInterface.CurrentConnection.wlanAssociationAttributes.dot11Ssid;
            connectedSsids.Add(new String(Encoding.ASCII.GetChars(ssid.SSID,0, (int)ssid.SSIDLength)));
        }
mariosangiorgio
+1  A: 

there is some more information in How do I get the available wifi APs and their signal strength in .net?

LDomagala
A: 

check the website http://wwww.daedaltech.com they give a dll with which we can find the SSID and mac address