Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use same object instance on multiple pages
Message
 
To
05/05/2004 17:17:17
General information
Forum:
Visual FoxPro
Category:
ActiveVFP
Miscellaneous
Thread ID:
00900416
Message ID:
00901410
Views:
15
Dan,

Generally its a really bad idea to store COM objects into Session (or worse Applicatin objects), because these objects need to be marshalled back to the original thread they were created on (at least VFP/VB COM objects that is). This means at best a lot of overhead for getting these objects back, and at worst deadlock situations if threads are busy and used by two objects at the same time.

This sort of thing usually works fine in low load scenarios, but as soon as you load the server this causes problems and can cause as you've found out inconsistent lock up scnearios.

The whole COM mechanism for dealing with persistedf objects beyond a single hit is very unstable in IIS in my experience. You are likely much better off reloading the object and restablishing state which is probably a better design anyway for a Web application to avoid resource usage overload for these objects cached in a Session object.


+++ Rick ---

>Thanks, Claude. I played around last night trying to save the entire object to the Session object with varied results. FWIW, the problems were as follows:
>
>1) After displaying the same page several times, the page would just cease loading
>
>2) Weird behavior with Datasessions. Progressing from one web page to another resulted in the Datasession changing from 2 to 3, and I had to issue SET DATASESSION TO 2 in order to resume processing my tables. Once I checked and ALIAS() equaled "Session", so I'm not sure if this was the result of AVFP doing something behind the scenes.
>
>Today, I've started saving the required properties to the Session object and this method seems to be working without problems.
>
>Regards,
> Dan
>
>>Dan, because of the stateless nature of the web, you would probably have to save it to the Session object. (better to use the Session object than the SessionTable object). It should be easy enough to test, though, in a simple experiment. You may be able to save the entire object to the Session and you would need to see how that affects your app. If not able to save the entire object, then properties could definitely be saved to session.
>>So, that user would be able to continually access those properties, but, other web users would not be able to access those properties(at least I don't think so). To do that sort of thing you'd need to use a table...
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform