473,810 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session Variables holding VB COM objects (Apartment Threading)

I have read couple of articles warning against the use of storing VB COM
objects (Apartment Threading) in Session Variables due to the fact that
these variables could go bad.

My question is what's the workaround this?

I have also read about making ASP Stateless...I'm guessing that means
turning the session and application variables off and if you do that
then how do you pass information for a particular user from one page to
another?

I'm confused about how to get an ASP site working without using
Application and Session variables as well as not storing VB COM objects
in Session Variables.

Any explanation in this regard would be very much appreciated.

Thanks,
Andy.

*** Sent via Developersdex http://www.developersdex.com ***
Dec 8 '05 #1
4 1734
Andy Kasotia wrote:
I have read couple of articles warning against the use of storing VB
COM objects (Apartment Threading) in Session Variables due to the
fact that these variables could go bad.

My question is what's the workaround this?
All you can do is create arrays or xml documents containing the data
contained in the COM objects ans store them in session/application instead.

I have also read about making ASP Stateless...I'm guessing that means
turning the session and application variables off You can only turn session off.
and if you do that
then how do you pass information for a particular user from one page
to another?

You would have to use a database, or txt/xml files on the web server

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 8 '05 #2
Bob,

Appreciate your response. I'm not sure if I understand how to implement
what you're mentioning. Are you suggesting that whatever data retrieved
from VB COM Ojects should be stored in XML files and to include the XML
files on every ASP page? If that's what you are referring to then,
wouldn't we be creating lots of XML files for each user that logs in and
how would be make sure that the data in the XML files corresponds to the
user that requested the data? If you or anyone else reading this post,
just on a high-level explain the process and setup flow, I would
appreciate that.

Thanks much,
Anand.
*** Sent via Developersdex http://www.developersdex.com ***
Dec 8 '05 #3
Bob Barrows or can anyone else give a high-level explanation of how the
above can/should be designed?

Appreciate all your responses in advance.

Anand.

*** Sent via Developersdex http://www.developersdex.com ***
Dec 9 '05 #4
Andy Kasotia wrote:
Bob,

Appreciate your response. I'm not sure if I understand how to
implement what you're mentioning. Are you suggesting that whatever
data retrieved from VB COM Ojects should be stored in XML files and
to include the XML files on every ASP page?
You've got it. That's exactly what i was talking about. You need a way to
persist the data from the COM object between pages, right? There's really no
need to persist the functionality in your COM object since it can be
instantiated whenever a page needs it.
If that's what you are
referring to then, wouldn't we be creating lots of XML files for each
user that logs in
Yes. A database may be a better solution ...
and how would be make sure that the data in the XML
files corresponds to the user that requested the data?


The naming convention for the files would include a reference to the user
that created them. It's up to you how this should be implemented. You could
even use the Session ID as part of the name of the files.
Again, a database would likely be better for this if you anticipate a lot of
user activity.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Dec 9 '05 #5

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

Similar topics

1
2021
by: DrewM | last post by:
I'm still thinking about session variables :-) Does anyone know the detail of how session variables are actually stored? The question I'm trying to answer is: Is it more efficient to store and retrieve multiple short strings : a) in multiple small session variables b) concatenated and stored as one large session variable c) inserted into an array and stored in a session variable
14
2607
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to create the object only when you actually use it. - Causes poor performance because the thread that created the object has to service all requests for it. Assuming I can live with the memory and performance implications (a big if,
6
1273
by: Just D | last post by:
Hi, How slowly is to work with these objects - Application and Session ? Is it much better to create a huge project or some static library and place all variables/constants there instead of many Session objects? When I removed some of Session objects and replaced by another approaches I got an illusion that application started working significantly faster? Is it true?
31
7013
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily using Session variables for three years now and i'm entering a project with my new boss who has never quite come around that session variables are ok. What's the concensus here. How can i convince him that they are ok in ASP.NET. OR
2
2137
by: Markus Prediger | last post by:
Hi NG, I have an asp.net project that uses an vb6 com object for some database-manipulation (I cannot rewrite it in .net, sorry, its not my decision). I want it to be instanciated seperately for each session, so that three users can connect to three different databases. But I get crazy because: -With interop all users share one instance - pure chaos (the instance is
6
1998
by: Gary Lee | last post by:
In VB.NET using CDO, I'd like to allow multiple threads to share a single MAPI.Session object. If I declare and instantiate sessions within each thread, I'm OK (although this negates the efficiency I'm looking to add). But when I declare, e.g., Public objSession As MAPI.Session I can't access objSession from a worker thread. Thanks in advance for any advice.
12
2213
by: Anthony Jones | last post by:
Here's a question that I've not been able to get a definitive answer to. Creating an STA object (such as a typical VB6 object) and assigning to the ASP Session store is a bad thing. It's a bad thing because it forces IIS to affiliate the Session with the Thread on which the STA object is created. This means all subsequent requests for that session can only be handled by that worker thread and can therefore result it in poor...
9
7304
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 be 'better' to store an instance of this class in a session-variable, so it's available all the time and needs to be instanced only once. Is this, generally speaking, a good idea, storing objects in session-variables ? Do you guys ever use this...
1
2679
by: =?Utf-8?B?QXZp?= | last post by:
Hi I have an interesting issue, I hope someone can shead light on: I have a 2 server "web farm" with a web app that produces image files. To ensure synchronization of content on both machines, we have built a vb.net (2.0) file watcher service to keep the web folders synchronized between the 2 machines. the app uses in-proc session variables for some other stuff. We have run into a strange problem: when the file watcher service is
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10124
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.