Click here to Skip to main content
Rate this: bad
good
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
proc.Start()
Return (proc.StandardOutput.ReadToEnd())
proc.WaitForExit()
 
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 5:44am

1 solution

Rate this: bad
good
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.
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 339
1 Sergey Alexandrovich Kryukov 119
2 DineshMaind 113
3 majid torfi 75
4 ChauhanAjay 73
0 Sergey Alexandrovich Kryukov 9,192
1 OriginalGriff 8,405
2 CPallini 2,613
3 Richard MacCutchan 2,231
4 Abhinav S 1,938


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 10 Nov 2012
Copyright © CodeProject, 1999-2014
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