A good explanation on how to use VeryByCustom Caching

Right there: http://www.aprogrammersjournal.com/article.aspx?id=58

 

 

The important part is this:

application level parameters

Application level parameters such as session variables or client side cookies are parameters that are page independent. To cach multiple versions of a page based on application level parameters you can use VarByCustom and the
global.asax file.

In my case the problem I was faced with was using Forms.Authentication in combination with output caching. If user A logged into my site I did not want it to "Welcome User A" to User B.

he first thing we will need to do is set the location of the output cache to "client or "server, this ensures that the page will not be cached by a proxy server. To learn more about caching location please visit:
This Link

Secondly you will need to set up an override function in your global.asax file

<Script language="VB" runat="server">

Public Overrides Function GetVaryByCustomString( _
ByVal context As System.Web.HttpContext, _
ByVal custom As String) As String

Select custom
     Case "username"
               Return Context.User.Identity.Name 
     Case Else
               Return MyBase.GetVaryByCustomString(context, custom)
End Select

End Function

</script>


And lastly specify your custom variable:

<%@ OutputCache Duration = "1200" VaryByParam="*" Location="Server" VaryByCustom="username" %>

So now if a user logs in he will receive his own custom cached page, as he browses around the site and hits the same pages, he will receive the pages that were cached for him.