Monday, December 20, 2004

Modal Pop-Up Window Cache (ASP.NET, Web-Services)

A strange thing happened A thing I didnt know about, happened :
I have a page which is using Web-services, lets call that page A. Page A opens up a modal popup window called Page B. Page B, OnLoad, calls a web-service to get data from the db and updates a datagrid inside itself. Now this grid, when data is added to the db during that session, doesnt seem to get updated. If debugged, the breakpoint in this method of the web-service, only gets hit the first time, and the subsequent times, its just doesn't hit the breakpoint. So if I want to see the updated data, I have to log off and log in again and then I can see the updated data. I was puzzeled about this unexpected behavior for quite long, and then I tried turning off the cache for this page.
So on PageLoad, i inserted these two statements :

Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetExpires(Now())

And _Voila!!_ it works as expected...

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

© Copyright 2005, Rohan Thomas
Disclaimer
This Blog contains findings that are self-explored and expressions that are self-evoked. They are by no meanss representions of my employer's view.