![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have an ASCX, with this directive: %@ OutputCache Duration="50000" VaryByParam="ctype" VaryByCustom="contentlist" Shared="true" % in my Global.asax I have this handler for the varybyCustom public override string GetVaryByCustomString(HttpContext context, string arg) { if(arg.ToLower() == "contentlist") { string strReturn = "b";// so it's not blank // Now check HttpCookie cookie = context.Request.Cookies["dictionize"]; if(cookie != null) { string tmp = cookie.Value.ToString(); strReturn += tmp; } return strReturn; } // Otherwise cache as normal return base.GetVaryByCustomString(context, arg); } My querystring has a parameter "ctype" which should generate a different version of the ASCX. I print the current time in both the Page and the ASCX so that I can figure out what's going on (cached or not cached). The Control is NOT cached consistently. It should cache for 50000 seconds no? Whenever I go to the page, a the time on the Page (dynamic) matches the time on the control (dynamic the first time it's cached then static after that). Subsequent requests show that the control is then being cached. (The times no longer match). Then after a few mins, not 50,000 seconds, the time gets updated again telling me that the ASCX was refreshed, as if the cache had been flushed? What's going on? Why does the new version get generated, it seems like it's being generated per SESSION and then just cached for the duration of the session. You can see it in action at http://www.FrancisShanahan.com The control is the main part of the page, the timestamp is displayed at the top of the middle and the top right of the page. I even put some debugging code in the Application OnStart to see if asp_net was restarting on the server without my knowledge but this is not the case. Can anyone shed some light on this topic? All "Google" resources are just throwing up the same very basic how-to articles. Doesn't seem like anyone has any experience with this. Thanks, -fs |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |