Hi,
I've added an override for GetVaryByCustomString to global.asax:
Public Overrides Function GetVaryByCustomString(ByVal context As
System.Web.HttpContext, ByVal custom As String) As String
Dim sTemp As String
Select Case custom
Case "agent"
sTemp = "agent=test"
Return sTemp
End Select
End Function
In my aspx page (code behind) I have the following code:
Response.Cache.SetExpires(Now.AddSeconds(600))
Response.Cache.SetCacheability(HttpCacheability.Public)
Response.Cache.SetVaryByCustom("agent")
The problem is that GetVaryByCustomString never fires. Anyone seen this
before?
Any thoughts?
Regards,
Gavin
GFaux - 29 Sep 2004 14:43 GMT
Got it working by adding the appropriate @ OutputCache to the aspx page, but
now I have another problem:
How do I make sure a page is not cached?
MyBase.GetVaryByCustomString(context, custom) returns nothing, which should
mean that the page is not cached. but I can't get this to work. Any help
appreciated....
Public Overrides Function GetVaryByCustomString(ByVal context As
System.Web.HttpContext, ByVal custom As String) As String
Dim oParams As FAPCollection =
Utils.CreatePageParams(context.Request)
Select Case custom
Case "agent"
If oParams.Collection.Count = 2 Then
If oParams.ExistsKey("agentid") AndAlso
oParams.ExistsKey("opt") Then
Return "agent=" & oParams("agentid") &
oParams("opt")
End If
End If
End Select
Return MyBase.GetVaryByCustomString(context, custom)
End Function
Thanks
Gavin
sudhir Sharma - 25 Mar 2005 21:23 GMT
Hi Buddy,
Did you find any solution to this problem. My problem is also same. the
Method "GetVaryByCustomString()" is not getting called. it is getting
called only twice. after that, control does not go to the method. Its
making me mad. I have this code in my .aspx file--
<%@ OutputCache Duration="100" VaryByCustom="ORGANIZATIONID"
VaryByParam="none"%>
Any help is appreciated.
Thanks
Sudhir