webresource.axd not caching on client (ret: 200 not 304)

Last post 07-11-2007 4:16 AM by plastical. 6 replies.

Sort Posts:

  • webresource.axd not caching on client (ret: 200 not 304)

    06-28-2007, 1:14 PM
    • Loading...
    • JRumerman
    • Joined on 03-01-2006, 6:26 PM
    • San Diego, CA
    • Posts 140

    Hi,

    My webresource.axd aren't returning Http Status: 304 (pulled from client browser cache) and for the life of me I can't think why. They're returning 200, meaning reloading from server.

    I've compiled in release mode and my compilation is set to debug="false". My browser is set to Automatically check for newer versions. I'm using ASP.NET AJAX and my ScriptResource.axd files ARE returning 304 status messages

    I'm running IIS 6.0 on Windows 2003. I've looked at the traffic using Web Development Helper, Fiddler, and HTTP Analyzer 2 and it all says the same thing.

    Here is a request to a ScriptResource 

    GET /PROPERTY/ScriptResource.axd?d=xXHyRhQ39AVIH62TuZ--7Aa3mhABc_C5l6w0tTMaZe8lpxj8SVqoV2GONWlzRgaGj37GYaRpmJ8sWmzDivv-kPXtcvxsbxdAGJn7gbJMzKc1&t=633126710456040000 HTTP/1.1

    Here is the response. 

    (Status-Line):HTTP/1.1 304 Not Modified
    Date:Thu, 28 Jun 2007 17:02:46 GMT
    Server:Microsoft-IIS/6.0
    X-Powered-By:ASP.NET
    X-AspNet-Version:2.0.50727
    Cache-Control:public
    Expires:Fri, 27 Jun 2008 16:57:53 GMT
    Last-Modified:Fri, 20 Apr 2007 17:04:05 GMT
    Content-Length:0

    Here is the request to my WebResource 

    GET /PROPERTY/WebResource.axd?d=HJejXre1kvmpIOcutOouIZyuttFxyblLItct1wcaEJ2NdriLTugm-uG3PDwrnDecKB64Fa9TxqsfMIKcFi5UCGSZlXHpZ4iRag8TtQ4PDjU1&t=633185426559430639 HTTP/1.1 

    Here is the response:

    (Status-Line):HTTP/1.1 200 OK
    Date:Thu, 28 Jun 2007 17:02:47 GMT
    Server:Microsoft-IIS/6.0
    X-Powered-By:ASP.NET
    X-AspNet-Version:2.0.50727
    Cache-Control:public
    Expires:Fri, 27 Jun 2008 16:57:55 GMT
    Content-Type:image/gif
    Content-Length:43

    The only difference I see is the "Last-Modified:Fri, 20 Apr 2007 17:04:05 GMT" header in the ScriptResource.axd response. Could this be the problem???

    How on earth do I get my webresoruces to be cached? I know it's possible.

    Thx, Joel

  • Re: webresource.axd not caching on client (ret: 200 not 304)

    07-10-2007, 11:07 AM
    • Loading...
    • plastical
    • Joined on 12-10-2002, 6:58 AM
    • Posts 7

    Hi Joel, did you manage to solve this problem? I've tracked both scriptresource.axd and webresource.axd via Fiddler, left debugging, traceing and viewstate (wherever possible). And still 84090k and 29530k are download everytime I refresh the page...

     

  • Re: webresource.axd not caching on client (ret: 200 not 304)

    07-10-2007, 9:11 PM
    • Loading...
    • rstrahl
    • Joined on 08-20-2003, 1:08 PM
    • Paia, Hawaii
    • Posts 249
    • ASPInsiders
      TrustedFriends-MVPs

    How are you refreshing the page? If you use Refresh (F5) Web Resources will always refresh because it overrides the Public caching. The Last-Modified indeed is a more persistent mechanism - without this header the client can't really tell when the content is out of date so the caching does a forced refresh on a browser refresh.

    You should however see proper caching of Web Resources if you're just accessing pages through links or button operations.

    +++ Rick ---

    Rick Strahl [MVP]
    West Wind Technologies
    Making waves on the Web
    www.west-wind.com/weblog
  • Re: webresource.axd not caching on client (ret: 200 not 304)

    07-11-2007, 2:35 AM
    • Loading...
    • plastical
    • Joined on 12-10-2002, 6:58 AM
    • Posts 7

    Uhm, it happens even when you click links...

    I was thinking that this maybe happens because I placed the ScriptManager tag in a Masterpage. Is that an issue?
    With Last-Modified what do you exactly mean? Is a web.config setting?

    Using fiddler on my site (www.plastical.com or www.vannin.ch - these both share common settings) you notice that scriptresource.axd is always downloaded to the client (meaning a +100k page reload or refresh, whatever). I monitored other .net 2.0 sites (also asp.net forum) and it downloads the resources only once, independently of F5 or by link! There must be something wrong with my code!

    Thanks for your support!

  • Re: webresource.axd not caching on client (ret: 200 not 304)

    07-11-2007, 3:13 AM
    • Loading...
    • rstrahl
    • Joined on 08-20-2003, 1:08 PM
    • Paia, Hawaii
    • Posts 249
    • ASPInsiders
      TrustedFriends-MVPs

    I thought you said the ScriptManager scripts are properly caching? WebResource.axd was the problem?

    You have no control over the headers that ScriptManager or WebResources are generating since it's internal to ASP.NET. The only things that have an effect on it are the debug setting in web.config.

    But I don't see your behavior. Everything will refresh always if you do a full f5 Refresh. Nothing refreshes if you reload the page (or another that's using the same resource) off a link.

    +++ Rick ---

    Rick Strahl [MVP]
    West Wind Technologies
    Making waves on the Web
    www.west-wind.com/weblog
  • Re: webresource.axd not caching on client (ret: 200 not 304)

    07-11-2007, 3:39 AM
    • Loading...
    • plastical
    • Joined on 12-10-2002, 6:58 AM
    • Posts 7

    The problem are both, script and web resource. They return both 200 whatever I do: click on a link or full refresh the page. The same doesn't happen with forums.asp.net or any other website. I set the debug false in web.config and did the same in the General.master page (my public fron masterpage) like this:  

    <asp:ScriptManager ID="SM" EnablePartialRendering="true" LoadScriptsBeforeUI="true" EnablePageMethods="false" 
    ScriptMode="Release" runat="server" />
    
    I hit my head on the table so many times to set it like this. I'm also using urlrewrite and flash (flash-control) and this was the only way to cache swf movies (setting something else would keep opening adobe's install script every time).
  • Re: webresource.axd not caching on client (ret: 200 not 304)

    07-11-2007, 4:16 AM
    • Loading...
    • plastical
    • Joined on 12-10-2002, 6:58 AM
    • Posts 7

    This is absolutely crazy: testing the pages again with fiddler (this time I checked enable gzip and hide 304) doesn't return 200 on the .axd files anymore.
    Kinda weird, isn't it?
    I hope this happens also for other visitors...

    Thank you Rick for your great support!

    PS.: You'd ask me why I'm testing performance with fiddler: well, I'm on a broadband cable network (>10Mbits) and download latencies are not perceivable with my bandwith...  

Page 1 of 1 (7 items)
Microsoft Communities
Page view counter