Thanks, Ken, for your reply. I am using 2.0. I still think I'm missing
something here. Here's how I have it coded..
My .ascx file:
<%@ OutputCache Duration="60" VaryByParam="None" VaryByCustom="category" %>
My aspx.vb file:
Response.Cache.SetVaryByCustom(category.ToString)
'Setup the main edit screen
myControl.Category = category.ToString
myControl.OtherProperty1 = "abc"
myControl.OtherProperty2 = def"
My Global.asax file:
Public Overrides Function GetVaryByCustomString(ByVal context As
System.Web.HttpContext, ByVal custom As String) As String
Return MyBase.GetVaryByCustomString(context, custom)
End Function
I always get and "Object reference not set to an instance of an object. "
error on the line myControl.Category = category.ToString.
What am I missing here?
Thanks for your help!
Steve
"Ken Cox - Microsoft MVP" wrote:
Are you using ASP.NET 2? If so, you should be able to use the
OutputCacheParameters.VaryByCustom Property to handle that scenario:
http://msdn2.microsoft.com/en-us/lib...om(VS.80).aspx
Ken
Microsoft MVP [ASP.NET]
"Steve" <sm*******@newsgroup.nospam> wrote in message
news:C8**********************************@microsof t.com... Hello. I'm trying to figure out how to cache a user control based on a
given
value. Here's my scenario:
* I have 3 properties in a user control which I set programatically in my
aspx.vb page. I want to cache the control based on one of the properties.
It's called "Category"
* I get the category through a variety of ways - either through session or
the database. It's never in the querystring or a field on the screen.
I can get the control to cache the first Category value, but not any
others.
The next time I get an "Object Not Found" exception when I try to set the
properties.
Any ideas how to do this?
Thanks for your help in advance!
--
Steve