472,992 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

Storing OleDBConnection in Session

Hi,
I have several pages in my app that all use the same
oleDBConnection(s). When this connection gets created, I store it as a
Session variable so that other pages can access it w/o having recreate
new connections every time they load.

I noticed during development that when ever the app first started, the
connection would not be in Session when I navigvated to a page that
used it. But with subsequent calls everything would be fine and the
connections would be there. I would only have a problem after not
running the app for a couple hours or so, and I figured this was
because the app had shut down. I was hoping this was just a glitch with
running under the IDE (VS 2005 RC).

I have now deployed this app to a server and whenever I try to get the
connection out of it's Session variable, it is not there - even on
subsequent requests. "(oleDBConnection)Session["dbConTProfile"]"
returns me null even though I have stored it there just seconds earlier
on another page.

Why isn't the object still in Session and am I doing this wrong to
begin with?

Thanks!

Curt

Nov 19 '05 #1
2 1675
Is there a reason you have stored the connection object(s) in session variables? I think that's quite inefficient to begin with. Normally, in an ASP.NET page, once the objects have been used up, they are destroyed. By storing them in a session variable, you increase load upon the server's memory. I can only speculate how the site would perform when several visitors are using it. So to answer your last question, I don't feel you're doing it the right way.

I am not sure why it doesn't load up the first time, but session variables expire by default after a set period of time, and as a result the object may have been disposed of then.

-Altaf [MVP]
--------------------------------------------------------------------------------

All that glitters has a high refractive index.
www.mendhak.com

"Curt tabor" <ct****@oneil.com> wrote in message news:11**********************@g44g2000cwa.googlegr oups.com...
Hi,
I have several pages in my app that all use the same
oleDBConnection(s). When this connection gets created, I store it as a
Session variable so that other pages can access it w/o having recreate
new connections every time they load.

I noticed during development that when ever the app first started, the
connection would not be in Session when I navigvated to a page that
used it. But with subsequent calls everything would be fine and the
connections would be there. I would only have a problem after not
running the app for a couple hours or so, and I figured this was
because the app had shut down. I was hoping this was just a glitch with
running under the IDE (VS 2005 RC).

I have now deployed this app to a server and whenever I try to get the
connection out of it's Session variable, it is not there - even on
subsequent requests. "(oleDBConnection)Session["dbConTProfile"]"
returns me null even though I have stored it there just seconds earlier
on another page.

Why isn't the object still in Session and am I doing this wrong to
begin with?

Thanks!

Curt

Nov 19 '05 #2
Yeah, that is pretty bad - duplicating all that for every session.
Thanks.

Curt

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Francisco | last post by:
I have this problem: I have a database with information about games, and users are able to vote for them. Everytime a user votes for a game I store the unique game name into a session variable (an...
0
by: Grant | last post by:
My C# web application connects to an Access database using the OleDbConnection and OleDbDataReader. I have 3 other computers that connect to this server but very frequently I get an 'Unspecified...
2
by: Grant | last post by:
My C# web application connects to an Access database using the OleDbConnection and OleDbDataReader. I have 3 other computers that connect to this server but very frequently I get an 'Unspecified...
2
by: jakk | last post by:
Below is the exception that Iam getting. It says that the DataView that Iam storing in the session is not Serializable. BUt works fine if I store in the inproc session and fails if I switch to...
3
by: Brad | last post by:
I am storing an array which contains about a dozen chracter items to a Session variable. Later, I need to use this array so I am doing the following: Dim eventTypes As String() =...
10
by: Mark Rae | last post by:
Hi, This relates to the previous thread "Disappearing Sessions", but is a bit more generic so I thought I'd start a new thread. This one relates to the storing of objects in Session once only to...
9
by: david | last post by:
I have a class with some business-logic and with every roundtrip, I need an instance of this class, so I have to create it, every time again. That doesn't seem very efficient. I thought it would...
1
by: None | last post by:
Hi, I have developed webshop application using asp.net 1.1. I'm using DataGrid in one of the pages of my site. During the page load the DataGrid will be binded by around 7500 products(rows). At...
3
by: RSH | last post by:
Hi, I have a situation where I have created an object that contains fields,properties and functions. After creating the object I attempted to assign it to a session variable so i could retrieve...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.