I made a page that allows users to login, if id and password are correct than it sets up a cookie and says 'Hi'. Now i can access any page on the site after logging in(Which was restricted if you arent logged)

Now this works fine in firefox and chrome but has some issues in ie6 and ie7.

The thing is, login is successful, but after logging in if i access the page ,which is only available if i'm logged in, it says "Restricted area need to log in"!! but i've already logged in, cookie has been set.
Now the fun part is if i hit the F5 key or refresh the page, everythng seems to work normal.

Now please tell me what is this all about , is it about caching stratagy in ie??

Perhaps it takes time for the cookie to be set in IE or that an additional page load (any page on the site) may be needed.

hmmm...well i dont think thats the issue here cwarn23....

I would say it is most likely to be an IE bug where the page with the cookie headers does not apply those cookie headers untill the page has been loaded a second time and that is why when you hit refresh those cookie headers suddenly come into effect. The reason why that bug would exist is that cookies are usually used for more than one page so probably find in Microsofts opinion, you don't need to use the cookie on the first page. Infact Micrsoft is trying to introduce a system where there are no such thing as cookies to protect personal data. That's why I prefer to use server side cookies.