background preloader


Facebook Twitter

Caching - How can I force clients to refresh JavaScript files. We are currently working in a private beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process.

caching - How can I force clients to refresh JavaScript files

That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client browsers still use the cached version of the file and they do not see the update. Obviously, on a support call, we can simply inform them to do a ctrlF5 refresh to ensure that they get the up-to-date files from the server, but it would be preferable to handle this before that time. Our current thought is to simply attach a version number onto the name of the JavaScript files and then when changes are made, increment the version on the script and update all references. This definitely gets the job done, but updating the references on each release could get cumbersome.

Http - What requests do browsers' "F5" and "Ctrl + F5" refreshes generate. It is up to the browser but they behave in similar ways.

http - What requests do browsers' "F5" and "Ctrl + F5" refreshes generate

I have tested FF, IE7, Opera and Chrome. F5 usually updates the page only if it is modified. The browser usually tries to use all types of cache as much as possible and adds an "If-modified-since" header to the request. Opera differs by sending a "Cache-Control: no-cache". CTRL-F5 is used to force an update, disregarding any cache.

If I remember correctly it was Netscape which was the first browser to add support for cache-control by adding "Pragma: No-cache" when you pressed CTRL-F5. Edit: Updated table. Static resource caching and cache-busting with ASP.NET MVC and AppHarbor. Serving static content (javascript, css, images) with headers specifying long cache expirations is easy. ASP.NET (MVC) Serving images. I am creating a MVC 3 application (although just as applicable to other technologies e.g.

ASP.NET (MVC) Serving images

ASP.NET Forms) and was just wondering if it is feasible (performance wise) to serve images from code rather than using the direct virtual path (like usual). The idea is that I improve the common method of serving files to: Apply security checksStandardised method of serving files based on route valuesReturning modified images (if requested) e.g. different dimentions (ok this would only be used sparingly so don't relate this to the performance question above).Perform business logic before allowing access to the resource. HTTP ETag. The ETag or entity tag is part of HTTP, the protocol for the World Wide Web.


It is one of several mechanisms that HTTP provides for web cache validation, and which allows a client to make conditional requests. This allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has not changed. ETags can also be used for optimistic concurrency control,[1] as a way to help prevent simultaneous updates of a resource from overwriting each other.

Deployment risks[edit] The use of ETags in the HTTP header is optional (not mandatory as with some other fields of the HTTP 1.1 header). Common methods of ETag generation include using a collision-resistant hash function of the resource's content, a hash of the last modification timestamp, or even just a revision number. In order to avoid the use of stale cache data, methods used to generate ETags should guarantee (as much as is practical) that each ETag is unique. Typical usage[edit] Jab2 - Static File Caching -Topten Software. Jab stores all static files in it's database and has an MVC action to serve those files.

Jab2 - Static File Caching -Topten Software

See my previous posts on File Management and Folder Support for more on how this looks from a user perspective. Today I noticed/remembered that I at the time I didn't correctly setup caching for these files. By default ASP.NET MVC only provides caching for static files coming off the file system. Anything served by code needs to examine the request headers and configure the response headers appropriately for caching to work effectively.

I'm not going to explain how HTTP caching works as there are plenty of other great articles out there. Implementing Caching and Compression Action Filter. Friday, March 28, 2008 3:12 AM Kazi Manzur Rashid Caching plays a major role in developing highly scalable web applications.

Implementing Caching and Compression Action Filter

We can cache any http get request in the user browser for a predefined time, if the user request the same URL in that predefined time the response will be loaded from the browser cache instead of the server. You can archive the same in ASP.NET MVC application with the following action filter: using System; using System.Web; using System.Web.Mvc; public class CacheFilterAttribute : ActionFilterAttribute { /// <summary> /// Gets or sets the cache duration in seconds. C# - How do I route images using ASP.Net MVC routing. Current community your communities Sign up or log in to customize your list. more stack exchange communities Stack Exchange sign up log in tour help careers 2.0 Stack Overflow Ask Question Take the 2-minute tour × Stack Overflow is a question and answer site for professional and enthusiast programmers.

c# - How do I route images using ASP.Net MVC routing