URL Rewriting breaking Output Caching

R

R-D-C

Can these two functions coexist?

We have a web site where the querystrings are removed using URL Rewriting.
Instead the page appears to be a html page with a long name (containing what
would be in the querystring).

I have tried switching on output caching and varying by a parameter and
using VaryByCustom but the caching simply does not work. Tested it by
adding the time to the bottom of the page and the time updates every time we
refresh the page, even though the timeout on the cache is 60 seconds.

Can anyone shed any light?
 
B

Brock Allen

When do you do the Url Rewriting? In global.asax? What method/event? The
output cache gets involved in the HttpPipeline fairly early, so you'd need
to plan when to do the rewriting. I've not tested the two together, so I'm
not sure what the results would be. I'll flag this post so I can go do some
testing. Fun stuff :)
 
R

R-D-C

I do the easy version of URL Rewriting ;-)

Say I want to see a URL in the browser that looks like
http://www.thingy.co.uk/English.News.23 that maps to
http://www.thingy.co.uk/news.aspx?Language=English&Story=23.

In global.asax BeginRequest I change the path using
HttpContext.Current.RewritePath("news.aspx")

I pass the querystring too and add an extra item to the querystring to say
waht the original URL was. I then pick this out in the page and use
HttpContext.Current.RewritePath to change the path again for postbacks.

Following this, the caching all goes to pot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,206
Latest member
SybilSchil

Latest Threads

Top