HighTechTalks DotNet Forums  

page output caching and url rewriting with IHttpHandler

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss page output caching and url rewriting with IHttpHandler in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?SmFzb24=?=
 
Posts: n/a

Default page output caching and url rewriting with IHttpHandler - 06-05-2006 , 10:45 AM






I have page output caching setup in my web.config like this:

<outputCacheProfiles>
<add name="Static" duration="300" enabled="true" location="Server"
varyByParam="url,id" />
</outputCacheProfiles>

This works fine for most of my pages. However, I am also using a custom
http handler to do some url rewriting. This handler takes urls like:

http://www.blah.com/article/1.aspx

and maps it to

http://www.blah.com/article.aspx?url...article/1.aspx

It doesn't look like article.aspx is caching. I have a timestamp in the
page, and if I refresh it I always get a new timestamp.

My handler implements IHttpHandler and does this:

context.RewritePath(targetUrl,string.Empty,"url=" + sourceUrl,true);
IHttpHandler handler = PageParser.GetCompiledPageInstance(targetUrl, null,
context);
handler.ProcessRequest(context);

Are there any issues with a custom http handler that would impact page
output caching?

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: page output caching and url rewriting with IHttpHandler - 06-06-2006 , 02:13 AM






Hello Jason,

I build a simple test web application in VS.NEt 2005, but I didn't find
same problem. Here is my code in the customized handler:

string targetUrl = "Test.aspx";
string sourceUrl = Request.Url.ToString() ;
context.RewritePath(targetUrl, string.Empty, "url=" + sourceUrl,
true);
IHttpHandler handler =
PageParser.GetCompiledPageInstance(targetUrl, null, context);
handler.ProcessRequest(context);

<httpHandlers> section in web.config:

<httpHandlers>
<add verb="*" path="*.aspx" type="MyHandler"/>
</httpHandlers>

Code for display time:

Response.Write(System.DateTime.Now.ToLongTimeStrin g());

I test this on a windows server 2003. Is there any difference from your
settings?

Regards,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Reply With Quote
  #3  
Old   
Paresh
 
Posts: n/a

Default Re: page output caching and url rewriting with IHttpHandler - 06-23-2006 , 02:47 AM



Hi All,

I am using ASP.net 1.1.

I have used HttpHandler for UrlRewriting for this I have used
Getcompiledpageinstance method.

Now because of this my caching logic is not working.

Scenario:

When user requests http://localhost/application/abc.html.I rewrite this
url as http://localhost/other_application/xyz.aspx using
GetCompliedPageInstance method.

Now I want to cache "http://localhost/application/abc.html" Url.


Is there any way for enabling page output caching for
"http://localhost/application/abc.html" Url.


Any help in this regards will be appreciated.

Thanks in advance

Luke Zhang [MSFT] wrote:
Quote:
Hello Jason,

I build a simple test web application in VS.NEt 2005, but I didn't find
same problem. Here is my code in the customized handler:

string targetUrl = "Test.aspx";
string sourceUrl = Request.Url.ToString() ;
context.RewritePath(targetUrl, string.Empty, "url=" + sourceUrl,
true);
IHttpHandler handler =
PageParser.GetCompiledPageInstance(targetUrl, null, context);
handler.ProcessRequest(context);

httpHandlers> section in web.config:

httpHandlers
<add verb="*" path="*.aspx" type="MyHandler"/
/httpHandlers

Code for display time:

Response.Write(System.DateTime.Now.ToLongTimeStrin g());

I test this on a windows server 2003. Is there any difference from your
settings?

Regards,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.