Connect to WPA networks

Jul 24, 2012 at 9:42 AM
Edited Jul 24, 2012 at 9:45 AM

Hi there!

I'm using the Managed Wifi API and I'm having some trouble. This is the situation: I took the example code and changed the profile that is created to fit my internet connection. It connects fine, but when I try to connect to a wifi connection at work, I am unable to use the API to establish a connection to the internet. The connectino at my house uses WEP, and the one at work uses WPA2PSK, so my question is if only WEP connections can be used.

I'll leave the profile of the WPA2PSK network here so you can see it and tell me if there is a mistake.

string profileName = "mCAT"; // this is also the SSID
string mac = "6D434154";
string key = "mediacat?11";
string profileXml = string.Format("<?xml version=\"1.0\"?><WLANProfile xmlns=\"http://www.microsoft.com/networking/WLAN/profile/v1\"><name>{0}</name><SSIDConfig><SSID><hex>{1}</hex><name>{0}</name></SSID></SSIDConfig><connectionType>ESS</connectionType><MSM><security><authEncryption><authentication>WPA2PSK</authentication><encryption>AES</encryption><useOneX>false</useOneX></authEncryption><sharedKey><keyType>networkKey</keyType><protected>false</protected><keyMaterial>{2}</keyMaterial></sharedKey><keyIndex>0</keyIndex></security></MSM></WLANProfile>", profileName, mac, key);

Thanks in advance!

Aug 1, 2012 at 11:12 AM

Hi,

For WPA2PSK there is different profile.

XML Profile changes depending on the type of Security and encryption. In below link u can find the types of profile depening on connection.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa369853(v=vs.85).aspx

Thanks