public void ProcessRequest(HttpContext context)
{
//Setting cache options
//TimeSpan -Default cache evrey 60 seconds
TimeSpan freshness = Properties.Settings.Default.ResourceCacheDif;
DateTime now = DateTime.Now;
context.Response.Cache.SetExpires(now.Add(freshness));
context.Response.Cache.SetMaxAge(freshness);
context.Response.Cache.SetCacheability(HttpCacheability.Server);
context.Response.Cache.SetValidUntilExpires(true);
context.Response.ContentType = "application/js";
//The list of all js resources
List<Resource> jsListResources = ApplicationHelper.JsResources;
//Constructing the array
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("var resourceArray = new Array(); ");
foreach (Resource item in jsListResources)
{
stringBuilder.Append(string.Format("resourceArray['{0}'] = '{1}'; ", item.Name, item.Description));
}
context.Response.Write(stringBuilder.ToString());
}