G
Guest
This is what I'm doing:
I'm using Httpmodules and Httphandlers to control access to files (images,
movies, etc.), but have run into quite a problem when several files are being
requested at the same time, from the same client.
To avoid having to push my database connection around to all the methods of
the classes I've build, the connection is stored in a static variable.
When several files are requested from the same client, at the same time, I
get exceptions when accessing the database ("already an open datareader" and
the like), and I've even gotten a datareader with the wrong data in.
When I'm in debug mode it's a big problem, when I'm building a release
build, it's less a problem, but still there. Once the web application is
under stress, my guess is that it will be a major problem.
To solve this problem, I set the IsReuseable boolean on the HttpHandler to
false, but that didn't help anything.
I thought that a static variable would be static per request, and that
setting the IsReuseable boolean would help, but that is not the case??
Am I missing something, or is this normal behaviour? The same problem arises
when I'm using iframes and have a httphandler catching the aspx requests.
It looks like the content of static variables "survive" from one request to
another, can't this be avoided?? And even worse the static seems to be shared
among more than one request at a time.
Does anybody have any experience with this, and any solution to the problem?!?
tia,
Steen
I'm using Httpmodules and Httphandlers to control access to files (images,
movies, etc.), but have run into quite a problem when several files are being
requested at the same time, from the same client.
To avoid having to push my database connection around to all the methods of
the classes I've build, the connection is stored in a static variable.
When several files are requested from the same client, at the same time, I
get exceptions when accessing the database ("already an open datareader" and
the like), and I've even gotten a datareader with the wrong data in.
When I'm in debug mode it's a big problem, when I'm building a release
build, it's less a problem, but still there. Once the web application is
under stress, my guess is that it will be a major problem.
To solve this problem, I set the IsReuseable boolean on the HttpHandler to
false, but that didn't help anything.
I thought that a static variable would be static per request, and that
setting the IsReuseable boolean would help, but that is not the case??
Am I missing something, or is this normal behaviour? The same problem arises
when I'm using iframes and have a httphandler catching the aspx requests.
It looks like the content of static variables "survive" from one request to
another, can't this be avoided?? And even worse the static seems to be shared
among more than one request at a time.
Does anybody have any experience with this, and any solution to the problem?!?
tia,
Steen