Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect wifi connectivity in c#

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?

like image 929
MJH Avatar asked Jul 18 '10 01:07

MJH


People also ask

How do I check my wifi connection?

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.

How can I monitor my internet using CMD?

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.

How do I check if my computer is connected to WiFi?

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.

How to check WiFi connection status from command prompt?

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.

How to check whether Internet connected via WWAN?

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.

How to check for an internet connection in a web application?

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.


2 Answers

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.

like image 96
casperOne Avatar answered Oct 17 '22 15:10

casperOne


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.

like image 30
sarme Avatar answered Oct 17 '22 16:10

sarme