5 Answers, 1 is accepted
Hi Rich,
Here is the code that sets the cacheability of the combined resource:
HttpCachePolicy cache = Response.Cache;
cache.SetCacheability(HttpCacheability.Public);
cache.VaryByParams[ScriptEntry.HiddenFieldParamName] =
true
;
cache.VaryByParams[ScriptEntry.CombinedScriptsParamName] =
true
;
cache.VaryByParams[CompressParameterName] =
true
;
cache.VaryByHeaders[
"User-Agent"
] =
true
;
cache.SetOmitVaryStar(
true
);
cache.SetExpires(DateTime.Now.AddDays(DaysToCache));
cache.SetMaxAge(TimeSpan.FromDays(DaysToCache));
cache.SetLastModified(GetLastModifiedDate());
cache.SetValidUntilExpires(
true
);
I believe the date you get is the last moment in time when the scripts were modified for that page (controls collection changed or external scripts that are combined were modified).
Considering the most common case - this is the date on which the Telerik.Web.UI assembly your application uses was built.
Regards,
Progress Telerik
You can expect different set of scripts only on a mobile device.
Best regards,
Rumen
Progress Telerik
Hi Rich,
You can find the following line:
cache.VaryByHeaders[
"User-Agent"
] =
true
;
in the Telerik.Web.UI\Common\ScriptManager\CombinedScriptsWriter.cs(338): file so you can download our source code and rebuild it with the changes you require.
Variations are likely to occur if you are using controls that have a mobile-specific render mode (list here) and you use that mode.
I advise, however, that you consider using the CDNs we offer to improve caching:
- for scripts: https://docs.telerik.com/devtools/aspnet-ajax/controls/scriptmanager/cdn-support/overview.
- for skins: https://docs.telerik.com/devtools/aspnet-ajax/controls/stylesheetmanager/cdn-support/overview.
- MS AJAX CDN (provided by Microsoft): https://docs.microsoft.com/en-us/aspnet/ajax/cdn/overview#Using_ASPNET_Ajax_from_the_CDN_20.
Regards,
Progress Telerik