Tutorial :How do I get a web part to refresh in IE?


I have a SharePoint web part that gets XML data from an .ASHX page, parses it and displays it using JavaScript. Everything works fine, until the XML changes. When I view the web part in IE, the new data is not updated until I close the browser. Even doing a CTRL-F5 does not grab the new data.

Firefox displays the new data immediately, with just a simple page refresh.

I have added a timestamp to the query string of my .ASHX page so that the XML result is not cached, but that did not fix my IE woes. Any other ideas?

The .ASHX page is using the API to access a list and is building the XML string, then returning that as an application/XML content type. I have confirmed that the XML is updated to reflect the new data in the list. I am also able to see the data consumed in the web part when it is displayed in FireFox.

I actually was generating the timestamp to append to my query in the server code, and then putting that string in the javascript. Once I moved the timestamp code to the javascript, things started working much better.


It's most likely cached, there's no other logical explanation why it would work in Firefox and not in IE. Try reloading IE several times in a row.

Check what headers that .ashx page sets.

It's not just your browser which could be caching the page, any middleware including web server might have a flawed caching implementation. You can also try using HTTP POST instead of GET because according to HTTP specification, POST requests should never be cached.


Is it a custom Web Part or one of the out-of-the-box Web Parts? It would make it easier to help you if you provided any more information on how you're retrieving the data from the HttpHandler (ashx).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »