November Happy Hour will be moved to Thursday December 5th.

httpCacheVaryByCustom and path

Vote:
 

I need to implement custom caching, I do this by overriding getvarybycustomstring in global.asax and adding my key to web.config. The problem is that the default key is "path" and when I debug getvarybycustomstring this returns the current url-path. However when I add my own key to web.config "path,mykey" getvarybycustomstring returns null, so it seems to disable caching on path which seems bad?

#36132
Jan 15, 2010 12:03
Vote:
 

VaryByCustom has always confused me, basically its just a string so if you use multiple values you have to split them up yourself in GetVaryByCustomString.

 

#36140
Jan 15, 2010 17:07
Vote:
 

Ended up doing this in my overridden GetVaryByCustomString

string val = base.GetVaryByCustomString(context, "path");

(if i instead send in the complete custom string with my addon this returns null)

I then append my own custom value to "val" and that seems to work.

#36190
Jan 18, 2010 15:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.