Try the following to fix the wifi connection problem.
Go to settings
Applications
Developement
Device Host Name
Change the host name to something 16 characters or shorter (Some routers don't like a host name longer than 16 characters)
This fixed my WIFI