By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,367 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,367 IT Pros & Developers. It's quick & easy.

Session provider - ResetItemTimeout called multiple times per page

P: n/a
I have written a custom session state provider that stores session data in
XML in a SQL database [don't ask why], and I was running the SQL profiler to
verify that all of my stored procedures were called in the correct
situations. Each time I visited certain pages, I noticed that the SP called
by the ResetItemTimeout method was called multiple times in a row.

I have tracked this problem down to the point of the WebResource.axd module.
It appears that the number of calls to ResetItemTimeout is equal to the
number of times a resource from WebResource.axd is referenced within my page,
such as for scripts and images. This specifically happens on pages where I
am using the TreeView control or the Login control.

Since there's no reason to have these extra hits on the database every time
a resource is referenced by a control, I'm considering updating my session
provider to simply skip the database call in ResetItemTimeout if
Context.CurrentHandler is of the "System.Web.Handlers.AssemblyResourceLoader"
type. However, I hate to hard-code something like that in. But after
looking at the code for the SessionStateModule class in Reflector, I can't
find any way other way to turn these unnecessary calls off.

Am I doing something wrong or is this just a problem with the way .NET 2.0
uses the AssemblyResourceLoader HTTP handler? It seems pretty excessive for
it to be updating the expiration value that many extra times when it should
already be updated when the main page is processed and it calls the GetItem
method.

I tested this using the default ASP.NET SQL Server sesssion state provider
and see the same type of results. The dbo.TempResetTimeout procedure is
called multiple times.

Jan 24 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.