Date:  06/12/2002 04:06:44 PM Msg ID:  000698
From:  Justin Thread:  000694
Subject:  Re: Re: Session Object
I understand the draw backs but it still would be nice to be able to do it, with the understanding if the server crashes i lose the current enviroment the use has created. I'm willing to take that risk, because it makes creating the business logic far simpler because i don't have to have two code bases one for desktop applications and one for foxweb with slight changes to make it work with a statless application.
 
Here is a thought.
 
how about having another application control and hold onto activeX and other class objects on the server so if the channels crash they simply restart and then request the object latter. 
 
Or you could try creating wrapper around the creation of objects somthing like
Session.Addclass('source of class', 'name of class'
Session.Setprop('name of class', 'name of prop', ;
 'comma delimted list of settings to pass to class')
Session.Getprop('classname and property')

then you could store all the above stuff to a table in the proper order so if the channels crash you can recreate it. 

 

Or you could use the object.SaveAsClass method which saves a object in memory into vcx file as is,  with all it properties and events

So what i would do is on the Error event have it dump all the objects that are in memory into a vcx file then recreate them. 

The only problem i see with this is if the channels crash and you an have ODBC/oledb data connection open you will have to recreate that no matter what. 

But if we add an event to our Classes call it Recreate, you could look for that event then call to reset certain properties like data connections if the channels crash

Justin Graf

 
Sent by FoxWeb Support on 06/11/2002 05:45:04 PM:
 
FoxWeb does not store session variables in memory, but rather in memo fields in a special system table.  There are many reasons for this, including the fact that channels get re-started after an error occurs and they live in separate processes, so they don't share the same memory space.  Storing session variables to disk also ensures that they will remain active even if you restart FoxWeb, or re-boot the server (unlike ASP).
 
Unfortunately, we currently don't have a way to convert VFP objects to binary blobs of data that can be saved to a table and then retrieved to re-create the original object.  I don't think there's a way to do this with VFP.  If any of you have other ideas, please let us know.
 

FoxWeb Support Team
support@foxweb.com email

Sent by Justin on 06/11/2002 08:58:24 AM:
Is there a way to make the Session Object a container for User Defined objects. 
 
something like this.
 
omynewobject = createobject('thisobject')
omynewobject.TheSettings ='hello World'
session.setvar('myobject', omynewobject)

then in other web pages go get the object i created ealier without having to recreate the object.

 

omynewobject = session.getvar('myobject')
 
Response.Write(omynewobejct.thesettings)
 

 

this would make my life allot easier when building my applications in the sense that the classes i create would control all the settings and keep track of every thing and speed things up sense i don't have to recreate the object all the time and reconnect to Remote Database servers.

 

I also understand this would be a memory burden on the foxweb server trying to keep track of the objects in memory.  but i would like it to be able to do this