Does your D-Link router have an option for SecuresSpot and it is disabled? There is a known issue with some D-Link routers with SecureSpot hijacking your Internet connection. The symptoms are being able to connect to your WiFi network, but most apps that use Internet not being able to send or receive data. One big clue is Safari being being sent to
http://dir-625.bsecure.com/ or a similar URL. Note that dir-625 is the model number of the router, so the URL may be different for you.
If this matches your situation, the temporary solution is to open your router settings, enable SecureSpot, save router settings, disable SecureSpot, then save the settings. This should temporarily fix the problem. These D-Link routers have a bad habit of enabling SecureSpot without notice, so you'll probably be doing this whole process again.
I got so fed up with doing this process over and over, that I contacted D-Link Tech Support, then customer support and had the router replaced.