Note: experienced users will be already knowing this, just sharing a little info for novices after flashing my phone for the first time
I had updated by phone to 2.3.4 from samsung Kies, and my phone couldn't connect to any Wifi after that. Should have googled a bit, this is known issue faced by many, but I thought samsung would have tested before giving update.
after sending a mail to samsung customer care, i got a lousy response. So decided to update the firmware myself.
After lot of research i found these great links.
Samsung Galaxy ACE S5830 Original Stock ROMs (2.2.1 Froyo and 2.3.3,2.3.4,2.3.5,2.3.6 Gingerbread) Firmware for Europe, Asia, Arabic Version ~ Android Solution
Odin Guide on How to Upgrade Samsung Galaxy Ace to Android 2.3.6 Gingerbread Firmware ~ Android Solution
Install Android 2.3.6 Gingerbread XWKT7 Update on Galaxy Ace
Those interested in theory, this is how it works, Samsung releases firmware update via kies which is specific to region (for eg. Russia, UK, India). Now a website called News - www.SamFirmware.com
takes these when they are released and makes them available to all. So I was able to update my phone with the 2.3.6 which was released for Nordic Countries - Denmark, Finland, Iceland, Norway and Sweden. Now since I am from India, i will not be able to use Kies as Kies is destination specific. To be able to use Kies again, i need to update my firmware which is India specific (which not yet released for 2.3.6). Although not being able to use kies is not a big issue.
Now even after updating to 2.3.6 my phone was not able to connect to Wifi, it was getting stuck in obtaining Ip address. This issue was resolved by using static IP explained here
Fix Obtaining IP Address Android WiFi Problem | Tricks Windows
the above settings works for me as I use BSNL, the static ip may differ for you if your router wifi is from a different carrier (like AT&T).
Now the wifi is connecting perfectly