[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

page output caching and url rewriting with IHttpHandler

Jason

6/5/2006 2:45:00 PM

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/arti...

and maps it to

http://www.blah.com/article.aspx?url=http://www.blah.com/arti...

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?
2 Answers

lukezhan

6/6/2006 6:14:00 AM

0

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.ToLongTimeString());

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.)

Paresh

6/23/2006 6:47:00 AM

0

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:
> 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.ToLongTimeString());
>
> 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.)