Telerik.Web.UI.WebResource.axd & Last-Modified

6 posts, 0 answers
  1. Rich
    Rich avatar
    3 posts
    Member since:
    May 2010

    Posted 27 Nov 2017 Link to this post

     Using RadScriptManager and EnableScriptCombine="true" I get a response header for Telerik.Web.UI.WebResource.axd of Tue, 11 Jul 2017 00:00:00 GMT.

     Where does that date/time come from?

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4087 posts

    Posted 30 Nov 2017 Link to this post

    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,

    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Rich
    Rich avatar
    3 posts
    Member since:
    May 2010

    Posted 11 Dec 2017 in reply to Marin Bratanov Link to this post

    Thanks Marin, that's great. One more question. The header also includes Vary:User-Agent, does the RadScriptManager vary the scripts in the combined resource based on User-Agent? In my very limited testing (Chrome/FireFox/IE) it seems to return the same combined script.
  4. Rumen
    Admin
    Rumen avatar
    13419 posts

    Posted 11 Dec 2017 Link to this post

    Hi there,

    You can expect different set of scripts only on a mobile device.

    Best regards,
    Rumen
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Rich
    Rich avatar
    3 posts
    Member since:
    May 2010

    Posted 13 Dec 2017 in reply to Rumen Link to this post

    Is there a way to have that header not appear? In testing, with the scripts we are using it does not appear to vary between desktop and phones/tablets.
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4087 posts

    Posted 14 Dec 2017 Link to this post

    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:


    Regards,

    Marin Bratanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top