0

The Issue

Recently, I deployed a page to production containing javascript which used setInterval() to ping a webservice every few seconds. The behavior can be summed up as follows:

Every X seconds, Javascript on the upcomingEvents.aspx page calls the hitWebService() function, which sits in the hitWebService.js file.

The X interval value set proved to be too small, so, I removed all references to hitWebService(), the hitWebService.js file itself, and the web service it was trying to reach.

Attempts to hit the web service from normal IP addressess dropped off, but I am still getting attempted hits from a number of users who use a proxy service.

My theory is that my upcomingEvents.aspx and hitWebService.js have been cached by the proxy service. Indeed, when I log the referrer strings when a user hits the error page (every so often, one of these users will get redirected here), they are being referred from upcomingEvents.aspx.

The issue is that the attempts to hit this web service are filling up the IIS logs at an uncomfortable rate, and are causing unnecessary traffic on the server.

What I have attempted

  • Removed web service completely
  • Deleting the hitWebService.js file, also replaced it with dummy file
  • Changed content expiration on IIS so that content expires immediately
  • Added Response.Cache.SetCacheability(HttpCacheability.NoCache) to the .vb codebehind on page
  • Completely republished site with changes
  • Restarted IIS, stopped and started IIS.

Interesting bits

  • I can alter the vb codebehind on UpcomingEvents.apsx to log session details, etc, and it seems to update almost instantly for the proxy service users

The Question

If my theory is correct, and the proxy server is indeed caching these the files hitWebService.js and upcomingEvents.aspx, are there any other routes that I can go down to force a code refresh, considering the above strategies haven't worked?

Thanks a lot,

1 Answers1

0

In my case, i had a ajax call begin cached by asp.net. I used a param with the javascript date number so each call have a different querystring.

like this:

function addQueryStringAntiCache(url)
{
    var d = new Date();
    var n = d.getTime();
    return url + (url.indexOf("?") == -1 ? "?" : "&") + "nocache=" + n;
}

you can do the same thing for script:

<script src="myScript.js?v=8912398314812" />

In case you have access to the machine, use fiddle to check it the browser even call to get the files or if it use it's own cache. In that case you can try to include metaData or http Header to prevent it caching it. Check this response

Hope it help you.

Benoit
  • 1,109
  • 14
  • 29