2 Replies - 459 Views - Last Post: 18 September 2013 - 01:05 AM

#1 nibbo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 26-August 08

Prevent javascript from caching

Posted 17 September 2013 - 04:42 AM

Hi All,

Been a while but I have nowhere else to turn... pleeeeeese help I'm going round the twist.

We have started using visual studio 2010 to develop .NET asp web sites.
I have noticed that this version caches all of the Javascript which means every time I make the slightest change I have to delete my browsing history to force it to pick up the latest version. Is there any way to prevent script files from being cached?

I have tried changing IIS settings to expire pages immediately but this does not seem to include .js or .css files!

I don't want to add random numbers or date/time stamps to filenames force it as this will impact caching when the site is deployed.

Why would Microsoft thing it is a good idea to cache pages that we are actively developing!

Thanks
Nibbo

Is This A Good Question/Topic? 0
  • +

Replies To: Prevent javascript from caching

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9094
  • View blog
  • Posts: 34,146
  • Joined: 12-June 08

Re: Prevent javascript from caching

Posted 17 September 2013 - 07:14 AM

I am unsure why this is a 'VS 2010' thing. Are you debugging/running the page from inside VS, or is this after you deploy it?

I've been using VS through that version, earlier, and beyond and have not encountered this problem.
Was This Post Helpful? 0
  • +
  • -

#3 nibbo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 26-August 08

Re: Prevent javascript from caching

Posted 18 September 2013 - 01:05 AM

Hi Modi123

Thanks for the reply.

This is whilst developing the web site and running it from within VS.
I have been doing this sort of development for years and I have never come across this problem before.
If I use the debugger in the Javascript file itself you can see that the stepped into lines are not the ones it is highlighting and the behaviours are definitely that of the old version of the script.
As an example I could put an alert in and run it which displays the alert. I can then delete the alert and run it again and still get the alert so it is definitely running a cached version.
Perhaps I am blaming VS 2010 unfairly (it may be an IE thing!) but I have certainly never had this with 2005 or 2008.

Thanks
Nibbo
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1