I am working on an asp.net (or winforms) app that is supposed to detect wifi connectivity and strength. The intention is to provide the field agents with an indicator that they can connect to our main office
What would I need to detect wifi connectivity?
On an Android phone or tablet, open the Settings app and go to Network Connections to manage Wi-Fi, Bluetooth, and other networks such as mobile network and VPNs. Some newer versions call this Network & internet.
Step 1: In the search bar type “cmd” (Command Prompt) and press enter. This would open the command prompt window. “netstat -a” shows all the currently active connections and the output display the protocol, source, and destination addresses along with the port numbers and the state of the connection.
Check if WiFi is connected. If your have a WiFi connection, how do you find out if your computer is connected to WiFi or not? The command netsh interface is used to find your WiFi connection status from command prompt. As you can see, the command shows that Wifi connection is connected when we ran the command.
The command netsh interface is used to find your WiFi connection status from command prompt. As you can see, the command shows that Wifi connection is connected when we ran the command. If the computer has WiFi enabled, but not connected to any network, then the command output would be like below. This command helps to know the status manually.
To check whether internet connected via WWAN use IsWlanConnectionProfile property of ConnectionProfile class Summary: Gets a value that indicates if connection profile is a WLAN (WiFi) connection.
To check for an Internet connection in.NET, we can use GetIsNetworkAvailable method defined in the System.Net.NetworkInformation namespace. But it returns a Boolean value that denotes whether any network connection is available and does not say about Internet connectivity to a website or IP address or host.
You can't do it in ASP.NET. ASP.NET is a server-side technology which renders client-side browsable code.
In order to do this, you would have to develop something that is embedded in the page (ActiveX, Java, Flash, Silverlight) and even then, you would have to have the appropriate security permissions from the user to access the APIs necessary to access the wifi antenna.
Take a look at WlanEnumInterfaces in the wlanapi.dll. You will have to pinvoke it from C#. There is a managed wrapper for it on Codeplex (http://managedwifi.codeplex.com), but I can't vouch for it as I've never used it personally.
You can still do with with ASP.Net if you don't mind writing an ActiveX object and your clients don't mind running it from your web site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With