How to send a notification to a device when it connects to a WiFi network without a specific app? I was staying in a hotel last week and when I connected to their WiFi network with my iPhone 4S, after agreeing on their terms and conditions (you must choose their network and it takes you automatically to the hotel's site where you agree some terms to complete the connection, many hotels charge you this way for their WiFi) a push notification trying to sell something came into my screen; this notification had "accept" and "later" buttons. Does anyone know how this happened, is it a notification launched by the website or sent directly though the WiFi network? I didn't have any apps related to the hotel which may have launched it.

This was not the kind of notifications you can look at in the notification center, it was more like a system alert.
You can stop that in the future by:

Changing: File Name

Captive network assistant


to

No More captive network assistant


in System/Library/CoreServices

So the file is still there. 

If you want to change it back just change the name back to original