Caching by Session variable

Results 1 to 2 of 2

Thread: Caching by Session variable

  1. #1
    Join Date
    Dec 1969

    Default Caching by Session variable

    I have been trying to make a custom caching technique ( VaryByCustom ) method to cache my page. I would like to read/write the session variables in my custom function, but because the only technique (that I found) to access the VaryByCustom function ( overriding GetVaryByCustomString ) is located in Global.asax (which does not give access to the session variable that I know of), it doesn&#039;t work.<BR><BR>I am looking for a way to READ AND WRITE session variables that utilizes the VaryByCustom call, so my caching will work.<BR><BR>Maybe there is an alternate way of caching with VaryByCustom instead of using Global.asax, or a way to read and write session variables inside Global.asax ?<BR><BR>Any suggestions?<BR><BR>Sean

  2. #2

    Default RE: Caching by Session variable

    Does this not work?<BR>public override string GetVaryByCustomString(HttpContext context, string custom)<BR> {<BR> object temp = context.Session["ItemName"];<BR> <BR> }<BR><BR><BR><BR>VaryByCustom <BR>Any text that represents custom output caching requirements. If this attribute is given a value of browser, the cache is varied by browser name and major version information. If a custom string is entered, you must override the HttpApplication.GetVaryByCustomString method in your application&#039;s Global.asax file. <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts