Context: ASP.NET MVC 3.0, .NET 4.0, C#, IIS 7
I have a long list of names (of game realms/servers). The realms are stored in a database.
I have an Action that returns the list as a JSON code.
I reference the list in my .aspx as following:
<script type="text/javascript" src='<%= Url.Action("Realms", "Data") %>'></script>
Here is an abbreviated action itself:
public ActionResult Realms() {
var realms = Data.GetRealms(...);
var json = JsonSerialize(realms);
return Content("realms = {0};".With(json), "text/javascript", Encoding.UTF8);
}
This list changes very seldom (once a month).
Question: how can I cause this .js file be cached client side?
Details My problem is that this "file" is being downloaded on each page refresh and accounts for 20% of the traffic.