![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Setting Output Cacheability Programmatically is Not Working - In Custom Handler Using .NET 3.5... in a "plain old" .aspx page I have the following code in the Init event: this.Context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); this.Context.Response.Cache.SetCacheability(HttpCacheability.Public); this.Context.Response.Cache.SetValidUntilExpires(false); It works great. Testing shows that the page is cached for 60 seconds as expected. Specifically, I insert the current date/time into the Response buffer, request the page, then hit F5 to see if the date/time value changes. It doesn't change until after 60 seconds have passed. That's as expected. But the exact same code seems to have no effect (the page isn't cached) when it's located in the Init event of a custom page that is built dynamically and entirely "from scratch" (from scratch - meaning that there is no aspx file to speak of... just a custom http handler that extends Page). Of possible relevance here is that my app has two http handler factories in play - one is ASP.NET's built-in factory for aspx pages, and another http factory that receives requests for dynamic pages. This second factory routes requests to the custom http handler that extends Page. In Global.asax BeginRequest, I call Context.RewritePath() to cause the requested page to be renamed to the page type for which requests are routed to my custom factory and subsequently built by my custom handler. So this amounts to URL rewriting. It should be noted that there is no querystring - much less querystring parameters that are changing between repeated requests for this page. So it is in this second "non standard" execution path that the output cacheing is not working. What could be - or is likely - happening here to prevent output caching of the dynamically constructed page? Thanks! |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Re: Problems with setting default mail handler | Live Mail | |||
| Problems with setting default mail handler | Vista mail | |||
| Accessing custom types output from custom cmdlet's in C# GUI | PowerShell | |||
| Custom Http Handler Factory and Possible Concurrency Issues on Application Start | .NET General | |||
| Programmatically setting user picture | Vista account administration | |||