Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Setting Output Cacheability Programmatically is Not Working - In Custom Handler

Reply
 
Old 05-22-2008   #1 (permalink)
Jordan S.


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46