There are many ways you can check in your c# application that internet on the machine is working or not. Sometimes you have such operations in your application which need an internet connection. So this post might be useful for you if you want to check before such operation if user has internet connection or not.

Simply use the following code and that’s it :)

add this namespace first in your form or class where you need this function.

then place the following code in your class.

That’s it now simply you can use this function where ever you need it like: (note i declare it as static, its up to you how you need it.)

Your feedback and comments are always welcome. If you have some other method for same purpose please share it as well.

Thanks

 

 

 

Contributed By: Sumbal Gee (9 Posts)

Sumbal, ***Software Engineer***