S5830 Wifi connected but internet doesn't work
I've been trying to solve this on my own for a long time, but I've found no clue on how to do it.
I have an ADSL2 router with wifi at home and many devices connected to it via wifi (smartphones, notebooks, pcs) and every one of them works fine. Only problem is my Samsung S5830 which connects to the wifi, THE INTERNET WORKS FOR A 4-5 SECONDS and then it just stops loading pages and everything else, it is connected to the wifi but the internet doesn't work. Every other device works on that router but this Ace. Strange thing is, that on other Wifi (hotspot made by my HTC One) the Ace works just fine, so it is not a problem with Wifi driver/rom or something like that.
Solutions I've tried :
1. *#*#526#*#* code to restart wifi driver
2. Using Static IP
3. Changing DNS
4. Restarting router/phone many times
The router is TP-Link TD-W8961NB.
Strange thing is that I cannot even access the router's configuration page on 192.168.1.1 after that 5 seconds, so the problem isn't just in accessing the internet.
Also, I've checked all firewall/security/blocking functions of the router and none of them should be responsible for this, noting that all other devices work.
Thanks for any other ideas, I'm seriously fed up with this.
HTC One 32GB