Programmatic OleDB access destroys current Session

D

daver

Hello all, I am running IIS 5.1 on Windows XP professional.
I am writing a web application in C# with Visual Studio.NET.

I would like to populate various data structures in my web application
from an Access database on the local hard drive. However, the instant
my code touches the Access database, it triggers the asp process thread
to recycle the current session state (calls Session_End), and I lose
all my other data (Session state is InProc).

I can copy and paste the OleDB code to read the Access file into a
console app, and it works fine...What could be going on here?

Thanks for any help,

Dave
 
G

Guest

It sounds as if the project/web site/DLL has been created with a dependency
on the Access Database. This would be the case is the database file was
"included in the project at design time". If it is so, then in the Visual
Studio project, right-click the Access DB file and specify "exclude from
project".

Hope this helps.
 
D

daver

No, the access DB was not included in the project at design time. I did
have some lingering references to the file from an old databound
control, but I removed them and the problem still persists.

One other thing, I cannot open the access DB with my local copy of
Access 2000, since it was created with Access 2003. I assume my version
of MDAC (2.8) is sufficient to handle this.
 
P

Patrice

How is named the DB and where is it located ?

It looks like some kind of file update is seen by ASP.NET (as if you were
writing web.config or something similar). My first try would be to put the
DB outisde of the web site to see if it still shows the same problem...
 
D

daver

Ah, thank you very much, this was exactly the issue. I moved the .mdb
file out of the web application directory and everything worked
properly.

However, I thought ASP.NET only recycled the web application if the
web.config file changed, and that it didn't care if other files in the
web application changed?? Does this mean that a) ASP.NET checks EVERY
file in a web application directory tree and b) read access to an
Access MDB file also modifies it?
 
P

Patrice

Doesn't look a normal behavior to me but as it was looking "as if" I thought
it would be interesting to give this a try to narrow down the problem.

I don't use MDB files but there is likely something wrong with your install.
Have you done something sepcial either witht he MDB file extension (such as
having this handled by ASP.NET to prevent downloading, or do you put your
MDB file in a file where you have ASPX pages etc...).

Anyway it"s likely better to have the DB outisde of the web site but I would
be curious to know what causes this problem...

--
Patrice


<[email protected]> a écrit dans le message de
Ah, thank you very much, this was exactly the issue. I moved the .mdb
file out of the web application directory and everything worked
properly.

However, I thought ASP.NET only recycled the web application if the
web.config file changed, and that it didn't care if other files in the
web application changed?? Does this mean that a) ASP.NET checks EVERY
file in a web application directory tree and b) read access to an
Access MDB file also modifies it?
 
B

Brendan Reynolds

Reading from the MDB would not, as far as I know, cause any modification to
the MDB itself, but it would cause a modification to the LDB (record locking
information file) which the Jet database engine will create in the same
location as the MDB file. So if the MDB file is in the web app folder, the
LDB file will also be created in that folder.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top