Hai,
Can you tell me, how to check the internet connection status(Active or inactive) through code?
Code should be in C#.
Thanks and Regards
Amir aka AutomationTester
How to check the Internet connection status?
-
- Posts: 30
- Joined: Mon Jan 21, 2013 1:31 pm
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to check the Internet connection status?
Hi,
Regards,
Peter
Ranorex Team
Use following codeAutomationTester wrote:Can you tell me, how to check the internet connection status(Active or inactive) through code?
Code should be in C#.
public static bool HasConnection() { try { System.Net.IPHostEntry i = System.Net.Dns.GetHostEntry("www.google.com"); return true; } catch { return false; } }FYI, it just took about 30 seconds to find this part of code using Google.
Regards,
Peter
Ranorex Team
-
- Posts: 30
- Joined: Mon Jan 21, 2013 1:31 pm
Re: How to check the Internet connection status?
Hai Peter,
Works like a Charm. Thanks
Thanks
Amir aka AutomationTester
Works like a Charm. Thanks

Thanks
Amir aka AutomationTester