InvalidCastException: System.Web.UI.PartialCachingControl -> MyCustomControl when OutputCaching
- by marcinn
The problem: I am unable to use OutputCaching with my controls which derives from MyCustomControl. Controls are loaded dynamically using definitions from database with Page.LoadControl method.
When I add to ascx <%@ OutputCache VaryByParam="*" Duration="3600"% the
"InvalidCastException: System.Web.UI.PartialCachingControl - MyCustomControl" exception is thrown.
I am unable to modify assembly witch contains dynamic loading controls logic. Is there any way to fix it in derived controls?
The second question is about iis7 and native output caching - is it resolves this problem? (I tried to set up several performance counters and I saw that cache wasn't hit...)