Groups | Blog | Home
all groups > asp.net > january 2005 >

asp.net : User Control Question


Roshawn Dawson
1/2/2005 9:57:03 PM
Hi All,

I've decided to code a web user control that uses the ASP.NET Repeater
control to render the output. This web user control obtains its data
from a web service. If I were to use fragment caching (<%@ OutputCache
Duration="3600" %>) with this control, will it call the web service each
time the page is requested or will it continue to use the web service
data until the cache duration expires?

I'd like to know as I'm trying to minimize the total number of requests
to the web service.

Thanks,

Derek Harmon
1/3/2005 12:10:44 AM
[quoted text, click to view]

The answer is Yes, output caching the user control (fragment caching) will
reduce the number of calls you're making to the web service.

Fragment caching produces the HTML from the user control the first-time it
gets requested which will include calling your web service. Thereafter, until
the fragment of HTML associated with your user control in the output cache
expires, ASP.NET will render the HTML that's been stored (and not perform
any dynamic processing of your user control, therefore it would not call the
web service). When the fragment in the cache expires, and a request comes
in that requires the HTML of your user control, then ASP.NET will again
perform the dynamic processing in your control (including a call to the web
service) to create a refreshed fragment which it will then return (and cache)
for another 3,600 seconds.


Derek Harmon

Roshawn Dawson
1/3/2005 1:19:58 PM
Thank you for your response. This is very useful stuff!

[quoted text, click to view]
AddThis Social Bookmark Button