I want duration to be configurable from Web.config file, so user can alter the output caching after deployment.
For achieving such purpose I need equivalent C# codebehind snippet of following ASP.NET markup?
<%@ OutputCache Duration="120" VaryByParam="CategoryName" %>
There is a way of programmatically setting cache duration for pages, though I’m not sure if this works for partial caching of user controls:
See http://support.microsoft.com/kb/323290
You can also add a PartialCaching() attribute to a user control to define caching:
Though I’m not sure how this could be manipulated programmatically, but it might give you some ideas.