473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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.No w.AddSeconds(60));
this.Context.Response.Cache.SetCacheability(HttpCa cheability.Public);
this.Context.Response.Cache.SetValidUntilExpires(f alse);

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!


Jun 27 '08 #1
0 1345

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Randy Jackson | last post by:
I'm trying to set up a simple redirect for errors and log them to a custom file. I'm doing this for work on remote servers where I may not have access to their error.log. Anyway, the code I've...
18
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
9
by: james.e.coleman | last post by:
Hello, I have created a custom dropdownlist that is used multiple times within a single page. When trying to set the values of the controls with the page in which they are being used, they all...
15
by: Oleg Subachev | last post by:
I need to programmatically invoke from other class Click event of the Button on my Form. Button.OnClick method is protected, not public. How to perform this ? Oleg Subachev
3
by: yellowtek | last post by:
Hi, I'm simply using PHP as a programming language, and I just want to print some text information to stdout, but instruction print "é" (é) does not print my "e" with an accent in the...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
2
by: Cramer | last post by:
I'm creating a custom handler that does not extend Page (only implements IHttpHandler) - and I would like for its output to be cached to improve runtime performance. I would like to leverage...
0
by: Jordan S. | last post by:
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));...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.