Click here to Skip to main content
13,259,194 members (52,624 online)
Rate this:
Please Sign up or sign in to vote.
I have been searching the internet for weeks now.
Is there a way I can connect to a network/router/access point through VB.NET?
I don't really care if the program needs administrative privileges.
I have already made a program which lists the access points in range.
The purpose of my program is to, when in range of a BT Openzone or FON hotspot, to connect to it.
I am at the point where the program has found a access point in range.
Now, I am not that good with APIs, so please if you refer me to one can you give me more or less step by step instructions what to do with it (eg. put this file in the app directory, add a reference to this file)

Here is my current code:
Private Function RetrieveNetworks()
Dim proc As New Process
proc.StartInfo.CreateNoWindow = True
proc.StartInfo.FileName = "netsh"
proc.StartInfo.Arguments = "wlan show networks mode=ssid"
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.UseShellExecute = False
Return (proc.StandardOutput.ReadToEnd())

I have managed to filter the output so I get a perfectly clean list of SSIDS.
Any help and I would be very grateful.
Posted 10-Nov-12 6:44am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You're not really writing a program to get a list of SSIDs and connect to them. If that was the case, you'd be using the Wireless Network API.

You're writing a program to ask another program what the list of SSIDs are.

Well, you can use the same technique to net NETSH to connect to another SSID. The command would look something like:
netsh wlan connect name={profile name} ssid={ssid to connect}

Of course, you need the profile name first. This means you have to use the command
netsh wlan show interfaces

and parse the result to get the Name, Radio type and Profile fields. The radio type will give you which interface to try and use. After all, you can't connect to an 802.11g SSID on a Bluetooth interface.

Once you have that table, you can use the Connect command as layed out above with the information in the table.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100