Session provider - ResetItemTimeout called multiple times per page

G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top