RadStyleSheetManager and RadScriptManager Cache
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);
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
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.