Search code examples
c#windowsapiconfigurationwifi

Wlan profile to connect to open wi-fi hotspot


What's the correct wlan profile to connect to open wi-fi hotspot? I'm using Native WiFi API and following profile:

      @"<?xml version=""1.0"" encoding=""US-ASCII""?>
        <WLANProfile xmlns=""http://www.microsoft.com/networking/WLAN/profile/v1"">
            <name>name_goes_here</name>
            <SSIDConfig>
                <SSID>
                    <name>name_goes_here</name>
                </SSID>                    
            </SSIDConfig>
            <connectionType>ESS</connectionType>
            <connectionMode>manual</connectionMode>
            <MSM>
                <security>
                    <authEncryption>
                        <authentication>open</authentication>
                    </authEncryption>
                </security>
            </MSM>
        </WLANProfile>"

But it fails saying that configuration of the network connection profile is corrupted.


Solution

  • @"<?xml version=""1.0""?>
    <WLANProfile xmlns=""http://www.microsoft.com/networking/WLAN/profile/v1"">
    <name>name_goes_here</name>
    <SSIDConfig>
      <SSID>
        <name>name_goes_here</name>
      </SSID>
    </SSIDConfig>
    <connectionType>ESS</connectionType>
    <MSM>
      <security>
        <authEncryption>
          <authentication>open</authentication>
          <encryption>none</encryption>
          <useOneX>false</useOneX>
        </authEncryption>
      </security>
    </MSM>
    </WLANProfile>";