I'm working on ASP .Net Core project. Every time when the user try to do something or press some button I need to check WiFi status or connection or signal. In case that the status or connection or signal is low I want to save some info in session or cookies or maybe in DataBase.
I searched around and I found this as a potential solution. So I was thinking to do something like this :
private void timer1_Tick(object sender, EventArgs e)
{
bool connection = NetworkInterface.GetIsNetworkAvailable();
if (connection == true)
{
//do nothing
}
else
{
//save some data
}
}
The problem is that if there is no WiFi signal, the program won't work and I can't save the data. So I need to save the data somehow before I lost the WiFi connection.
I allready read this and Detect wifi connectivity in c# ,but I have not found anything that maybe can help me. Also i saw that there are API that check WiFi connection, but I don't get it how to use it, and where should I call the method the check the WiFi status? I haven't tried any of these solutions yet, and i don't know if it works.
Any suggestions or examples?
Thanks in advance!