Groups | Blog | Home
all groups > asp.net caching > september 2005 >

asp.net caching : Caching and Session state


Jon
9/14/2005 4:22:03 PM
Our website caches a number of high-traffic pages, such as the home page. I
just noticed one behavior on our cached pages that's causing a problem- when
a user loads a cached page, an ASP.NET session is not started.

Our code in the Session_Start event only fires when the user lands on the
first non-cached page. This is causing a lot of pain because we need to
track inbound referrer URLs and querystring values whenever a user lands
anywhere on our website from another domain.

Is there any way to configure a cached page so that when users land on it a
session_start event will be fired?

Alvin Bruney - ASP.NET MVP
9/15/2005 10:20:42 AM
The behavior is as expected. You should probably try something else like
varying the cache parameters or combining the session start count with some
code inside a request handler that always executes to determine if this is a
new session or not.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



[quoted text, click to view]

John DeGuenther
9/23/2005 7:18:05 AM
One thing you can do is to place the contents your home page inside an .ascx
control and cache the output of the control. Your home page can include this
control, which then satisfies the requirement to cache the page output.

The home page (.aspx) will still generate an ASP.NET session, yet you still
place minimal load on your web server by caching the control output.

[quoted text, click to view]
Jon
9/23/2005 10:57:02 AM
This is what I've done in the past, and it's worked very well. But I was
looking for an easier approach ;) Thanks, Jon

[quoted text, click to view]
AddThis Social Bookmark Button