Not sure I fully understand your question but, while the cache condition is
satisfied, none of your code around that user control code behind will be
executed (which is exactly why the cache is a good thing from  a perf
perspective)

 

ASP.Net takes the HTML result of that user control and stores it *verbatim*
while the cache condition is satisfied. While its being served from cache,
ASP.Net will take that output and simply push it back as the response
without executing any server side code (as far as that control is
concerned).

 

The answer (if I understand what you are asking) as to reduce the cache time
or Vary the cache instance by a param other than UserId.

 

-          Glav

 

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Anthony
Sent: Tuesday, 7 September 2010 5:17 PM
To: 'ozDotNet'
Subject: usercontrol caching

 

I have a user control  which is set to output cache using the following
command..

 

<%@ OutputCache Duration="1000" VaryByParam="UserId" %>

 

When the usercontrol is being cached the usercontrol is no longer availble
so my code where ... usercontrol.userid=89   fails!

 

Do i just wrap this code in 

 

If usercontrol isnot nothing then

usercontrol.userid=89   

End if

 

Or is there a 'proper' way to do this?

 

Is your website <http://www.intellixperience.com/signup.aspx>  being
IntelliXperienced?  | www.yougoingmyway.com ?
regards
Anthony (*12QWERNB*)

Is your website being IntelliXperienced?

 

 

Reply via email to