+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / RadStyleSheetManager and RadScriptManager Cache

RadStyleSheetManager and RadScriptManager Cache

3 posts, 0 answered
  1. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    08 Mar 2012
    Link to this post
    Is it possible to adjust the cache expiration on outputted stylesheets and scripts via the RadStyleSheetManager and RadScriptManager controls? I see a CacheSettings on RadScriptManager but that only gives the option to disable caching.

    Cache expiration appears to be set to one year from today. This presents a problem when I try to modify my scripts or stylesheets.

    I could over come this by creating new stylesheets and scripts (or renaming old ones), but that seems like a hassle. Ideally I'd like to expire script and stylesheet cache at the end of the day. Any suggestions?

    I could also do this with the Global.asax, but that seems overkill. Any way to set this on the Rad controls directly?
    protected void Application_EndRequest(object sender, EventArgs e)
    {
       if (Request.FilePath.EndsWith("Telerik.Web.UI.WebResource.axd"))
       {
          Response.ExpiresAbsolute = DateTime.Today.AddDays(1);
       }
    }

    Thanks
  2. Pavel Iliev
    Pavel Iliev avatar
    140 posts
    Registered:
    18 Jul 2016
    12 Mar 2012
    Link to this post
    Hi Eric,

    Do you experience any specific problems with the caching of the scripts/CSS files? The controls are not providing such functionality out of the box. If you're using embedded resources you should not experience any problems with this because the urls that are generated will be different when there are changes. 
    Your solution is not covering all the aspects related to the caching and it will be good if you can provide more information about the issues you want to resolve.


    Kind regards,
    Pavel Iliev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Eric
    Eric avatar
    147 posts
    Registered:
    12 Nov 2007
    23 May 2012
    Link to this post
    So you're saying if I include these as embedded resources instead as files, it would adjust the URL based on the content of the files? Because as file paths, it doesn't. I'm including them like the following: <telerik:StyleSheetReference Path="~/styles/style-min.css" />

    The URL changes for the stylesheet if I add or remove stylesheets. But if I change the content of a stylesheet, the URL remains the same, so the user doesn't get the new styles. I can resort to including a new dummy stylesheet each time I want to change the content of another stylesheet, but that's ugly.

    It'd be nice if I could do one of the following
    * Have the URL update automatically based on the last change date or content of the stylesheets
    * Set the expiration date on the RadStyleSheetManager
    * Be able to append a value to the querystring of the AXD

    I'm just talking about the RadStyleSheetManager above, but the same goes for RadScriptManager.
3 posts, 0 answered