Nomal Afzal Nomal Afzal - 1 month ago 17x
ASP.NET (C#) Question

Remove query strings from static resources

My website is running on ASP.NET platform and recently i test my website on pingdom and i found the below error.

Resources with a "?" in the URL are not cached by some proxy caching
servers. Remove the query string and encode the parameters into the
URL for the following resources: ...
63Nawdr4rAt1lvT7c_zyBEkV9INg0&t=ffffffffe3663df5 ...

Here is the screenshot check it


Simple leave it as it is (its not an error !) - you can not remove this query string from resource because this is the id on how to load that resource from

The message that you get is actually talk for a proxy caching servers - what is a proxy caching server ? a middle computer that cache pages of your site, not the actually client computer - that can hold in cache that page and not bring slower your site in general.

So your client can hold that resource on cache if you set them correctly, and from what I see take care correctly and you resource are cached just fine - see this screen shot.

enter image description here

Now if you wish to add even more aggressive cache you can use the global.asax and do something like

protected void Application_BeginRequest(Object sender, EventArgs e)
    string cTheFile = HttpContext.Current.Request.Path;

    if (cTheFile.EndsWith("WebResource.axd", StringComparison.InvariantCultureIgnoreCase))

private static void JustSetSomeCache(HttpApplication app)
    app.Response.Cache.AppendCacheExtension("post-check=900, pre-check=3600");
    app.Response.Cache.SetMaxAge(new TimeSpan(32, 0, 0));
    app.Response.AppendHeader("Vary", "Accept-Encoding");

What is the different ? The second cache is not check the server at all for file change as the do, you can gain one webserver call.