Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / June 2006

Tip: Looking for answers? Try searching our database.

page output caching and url rewriting with IHttpHandler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 05 Jun 2006 15:45 GMT
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=http://www.blah.com/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?
Luke Zhang [MSFT] - 06 Jun 2006 07:13 GMT
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 - 23 Jun 2006 07:47 GMT
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

> Hello Jason,
>
[quoted text clipped - 34 lines]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.