Reputation: 133
I have a Windows 7/8 program that manages my wifi connections in the background. I use C#, ManagedWifi, and NETWORKLIST to do this although the language isn't important.
The program works fine except for the case when I connect to a network where the "Additional log on information may be required. Click here to open your browser." balloon appears.
I would like to detect/intercept this and open the browser automatically within the context of my program.
Ignoring the browser part, is there an event, network property, or anything else I can use to determine that this is the case and, thus respond to it.
Many "open" hotspots do this to display the T&Cs of use and Cisco/Linksys routers that have the "guest" facility also do this.
Any help greatly appreciated.
Regards, Jim
Upvotes: 2
Views: 9519
Reputation: 10154
Have a look at this page:
Q: How does Windows know that “additional logon information may be required?” When I connect to a hotspot, sometimes Windows pops up this message. When I open my browser, the hotspot requires me to agree to terms or to provide a username to access the Web like at a hotel or airport. How does Windows know this? Does it know the hotspots used at every hotel? – Anonymous
A: It does seem almost creepy, doesn’t it, when Windows seems to know that the hotspot requires a login before even you do? Thankfully the answer lies in networking smarts and not anything supernatural.
Whenever a Windows Vista or Windows 7 machine connects to a network, it performs a few quick diagnostics. One such diagnostic is that it attempts to send a Web request to the address www.msftncsi.com, and it analyzes the result.
If the connection is fully working, that address returns a simple text file that Windows recognizes. Hotspots that require a login or a terms-of-service acknowledgement capture your Web requests and redirect them to the hotspot page until you are authorized. Therefore, when Windows tries to retrieve this file, it fails due to hotspot redirection.
To be clever, Windows then performs a DNS lookup on its own website. The hotspot will resolve the address, even though it won’t let you access the site. In this case, Windows then concludes you are at such a hotspot and pops up the “additional log on information may be required” message. If the DNS lookup itself fails, Windows concludes that there is actually a problem connecting to the Internet, and instead displays the message “No Internet access.”
You might want to try to do the same - when a wifi connection is established, try to connect to www.msftncsi.com, and if it fails, try a DNS lookup.
Upvotes: 1