Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session provider - ResetItemTimeout called multiple times per page

Thread Tools

Session provider - ResetItemTimeout called multiple times per page

Posts: 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

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.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session.Add method - what if called multiple times with the same k =?Utf-8?B?TWFydGlu?= ASP .Net 2 12-16-2011 12:44 PM
Simple sproc executes 240 times slower when called from thanwhen called from QA Radu ASP .Net 7 08-28-2009 09:09 PM
WebService called by automation dll times out when being called from Navision Felix ASP .Net Web Services 1 09-29-2006 01:43 PM
three times copy ctor called, one ctor called, why? Apricot C++ 4 04-16-2004 07:55 AM
Why is the Constructor called 4 times but the Destructor 5 times? djskrill C++ 9 10-01-2003 07:18 PM