Bitco Software
Bitco Software

Reputation: 437

ASP.NET Browser Cache causing issues

I have looked for answers to this question, but I am not sure if I am asking it right.

I am looking for what do developers do in this situation:

I am developing an ASP.NET C# applications. I have CSS and SCRIPT files, and I am using jQuery. I install my application to the Web Servers (or I have my customer install them). If I have made any changes to my script files by adding some new jQuery or something, my customers don't get that effect after I do an update. I assume that the reason is that their browsers cache the file on the local computer and they do now download the new file from the server.

In my development environment I clear the cache when I close the browser and on IE I tell it in options to always load from the server. That way when developing I never have cached data.

What is the best practice to make sure that if I do make changes, those files get refreshed on the client computers after I do an update? Is there something in Code I can do?

I really don't want to change the filename and update all my script references.

Thanks, Cory

Upvotes: 0

Views: 298

Answers (1)

Duncan Howe
Duncan Howe

Reputation: 3025

The traditional way is to append a query string argument to the end of the reference to the css/script file path. For example, if you append a build number as the query string, each version of the software will make its own request for the relevant resource.

Upvotes: 1

Related Questions