Storing Classes in the "Session" Object 
Author Message
 Storing Classes in the "Session" Object

Does anyone know of explanations and exmples how to use VBScript (or
jscript) classes and keep them in the "Session" or "Application" objects?


Wed, 10 Nov 2004 02:23:39 GMT  
 Storing Classes in the "Session" Object
I believe that VBScript and JScript classes don't persist outside of the
page that they are generated in - someone please correct me if I'm wrong.

If you need to persist classes then I suggest you use WSC components and
defined the properties and methods within that so that each property stores
itself in the session / application object and retrieves it as required.

Let me know if you would like an example of this.

My Opinion: WSC is the best thing since sliced bread - script based COM
components that give intellisense in the Interdev development environment.

Chris Barber.


Does anyone know of explanations and exmples how to use vbscript (or
jscript) classes and keep them in the "Session" or "Application" objects?



Wed, 10 Nov 2004 01:31:13 GMT  
 Storing Classes in the "Session" Object
Thanks. Yes, I do.


Quote:
> I believe that VBScript and JScript classes don't persist outside of the
> page that they are generated in - someone please correct me if I'm wrong.

> If you need to persist classes then I suggest you use WSC components and
> defined the properties and methods within that so that each property
stores
> itself in the session / application object and retrieves it as required.

> Let me know if you would like an example of this.

> My Opinion: WSC is the best thing since sliced bread - script based COM
> components that give intellisense in the Interdev development environment.

> Chris Barber.



> Does anyone know of explanations and exmples how to use vbscript (or
> jscript) classes and keep them in the "Session" or "Application" objects?



Wed, 10 Nov 2004 02:38:14 GMT  
 Storing Classes in the "Session" Object

OK - put the following files (in the attached zip) into a web project in
IIS.

You will need to register the WSC *once* only - any changes to it after that
are fine - it has no concept of binary compatibility as a scripted COM
component. However you will be able to see (open it in Notepad for example)
that it has a public interface and internal implementation in JScript and
VBScript.

When you register it (right-click and select Register if you have IE 5.5+
installed) you will see that it generates a tlb file (see the internal
script routine to do so).

When  you've done that then run the DemoInit.asp page (it sets a couple of
properties of the WSC component) and then opens the DemoTest.asp page to
show you that the session persisted property still holds data. I have also
included a demo JScript function to show that you can mix and match script
engines.

It is possible to use these without registering them by using the
GetObject() call instead of CreateObject(). However, you won't get any
intellisense (in Interdev foe example).

You can also step into the script in Interdev debugging but it's not the
easiest thing to set-up. Pay careful attention to the debug="true" and
error="true" at the top of the WSC file - set these both to "false" ina
production environment to stop errors generating a dialogbox on the
webserver (not a happy occurrence).

Any questions, email me.

Also, see microsoft.public.scripting.scriptlets newsgroup.

Have fun.

Chris Barber.


Thanks. Yes, I do.


Quote:
> I believe that VBScript and JScript classes don't persist outside of the
> page that they are generated in - someone please correct me if I'm wrong.

> If you need to persist classes then I suggest you use WSC components and
> defined the properties and methods within that so that each property
stores
> itself in the session / application object and retrieves it as required.

> Let me know if you would like an example of this.

> My Opinion: WSC is the best thing since sliced bread - script based COM
> components that give intellisense in the Interdev development environment.

> Chris Barber.



> Does anyone know of explanations and exmples how to use vbscript (or
> jscript) classes and keep them in the "Session" or "Application" objects?

  demo.zip
2K Download


Wed, 10 Nov 2004 02:27:43 GMT  
 Storing Classes in the "Session" Object
Hmm.

OK - small issue, no intellisense.

After a bit of research, remove the script section in the
<registration></registration> section that generates the typelibrary - it
works but kills the intellisense for some reason.

After that, you'll have intellisense in Interdev but you'll have to keep
each WSC in a seperate folder cos they (when you have more then one) all
generate the same name typelibrary (.tlb) file. 'scriptlet.tlb'.

Chris Barber.


OK - put the following files (in the attached zip) into a web project in
IIS.

You will need to register the WSC *once* only - any changes to it after that
are fine - it has no concept of binary compatibility as a scripted COM
component. However you will be able to see (open it in Notepad for example)
that it has a public interface and internal implementation in JScript and
VBScript.

When you register it (right-click and select Register if you have IE 5.5+
installed) you will see that it generates a tlb file (see the internal
script routine to do so).

When  you've done that then run the DemoInit.asp page (it sets a couple of
properties of the WSC component) and then opens the DemoTest.asp page to
show you that the session persisted property still holds data. I have also
included a demo JScript function to show that you can mix and match script
engines.

It is possible to use these without registering them by using the
GetObject() call instead of CreateObject(). However, you won't get any
intellisense (in Interdev foe example).

You can also step into the script in Interdev debugging but it's not the
easiest thing to set-up. Pay careful attention to the debug="true" and
error="true" at the top of the WSC file - set these both to "false" ina
production environment to stop errors generating a dialogbox on the
webserver (not a happy occurrence).

Any questions, email me.

Also, see microsoft.public.scripting.scriptlets newsgroup.

Have fun.

Chris Barber.


Thanks. Yes, I do.


Quote:
> I believe that VBScript and JScript classes don't persist outside of the
> page that they are generated in - someone please correct me if I'm wrong.

> If you need to persist classes then I suggest you use WSC components and
> defined the properties and methods within that so that each property
stores
> itself in the session / application object and retrieves it as required.

> Let me know if you would like an example of this.

> My Opinion: WSC is the best thing since sliced bread - script based COM
> components that give intellisense in the Interdev development environment.

> Chris Barber.



> Does anyone know of explanations and exmples how to use vbscript (or
> jscript) classes and keep them in the "Session" or "Application" objects?



Wed, 10 Nov 2004 03:05:50 GMT  
 Storing Classes in the "Session" Object
You can use AsunderStone Distributed Environment. This tool allows writing
logic in script, which available as COM objects for ASP. Regardles WSC, here
can be specified relations between modules, even running on sveral
computers. Also provided several types of datastores (Array, Map, database,
XML).

Sincerely,
Alexander Fedorenko,
MCP.


Quote:
> Does anyone know of explanations and exmples how to use vbscript (or
> jscript) classes and keep them in the "Session" or "Application" objects?



Mon, 02 May 2005 22:13:01 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Storing Classes in the "Session" Object

2. Storing Classes in the "Session" Object

3. Access

4. I really need help with this one

5. Great Site

6. Storing values in an "artificial" session

7. Creating a "MAPI.session" object

8. Creating a "MAPI.session" object

9. Creating a "MAPI.session" object

10. AreJscript Classes "True" classes that can be stored in ASP Session Variables?

11. ADSI "session" object

12. Class Objects stored into session variables, not possible?

 

 
Powered by phpBB® Forum Software