Re: Maintaining State Between Web Pages





"Old Pedant" <OldPedant@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:14752B59-5E47-49D5-B702-0F8333E1DA1D@xxxxxxxxxxxxxxxx
Depends on what "between pages" means.

Between successive page hit BY THE SAME PERSON? That is, page hits within
the same SESSION?

Or between all page hits by all users?

If the latter, it's easy. Just use static data (shared in VB). All users
will get the same data.

But I'm guessing you mean between hits in the same session.

In which case you've got some choices.

First off, *IF* you coded your COM object using the right threading model,
you could simply store an instance of the object in a session variable.

Set myObj = Server.CreateObject("myfoo.whatever")
...
Set Session("foo") = myObj

If you used apartment threading, this is a bad idea. When the object is
needed again, it has to be instantiated in the same thread it was created in.
Can cause performance bottlenecks. Having said that, it's not a *terrible*
idea if your web site is only lightly loaded and especially if your component
is only used for (say) a fraction of a second on each page. But if you want
the best possible performance, you need to make the object "both threaded."

It's my understanding that VB6 is not capable of creating "both threaded"
COM objects, though I *believe* it can produce apartment threaded ones. You
don't say how you created your custom object, but if you did it with VB, you
are stuck.

Incidentally, you *MUST* use
Server.CreateObject
and *NOT* just
CreateObject
if you intend to save the object in a Session value, or at least that is my
own understanding.

I'm NOT an expert on this stuff. I created a grand total of two COM objects
for use with ASP, mainly just to see how it was done. Since most ISPs won't
allow you to install your own custom objects, and since all but one of the
web sites I've worked on were hosted by ISPs, it seemed pointless to use them.



You could also create in the global.asa. Perhaps even declare it using the object tag.


--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

.



Relevant Pages

  • RE: Maintaining State Between Web Pages
    ... Or between all page hits by all users? ... But I'm guessing you mean between hits in the same session. ... If you used apartment threading, ... web sites I've worked on were hosted by ISPs, it seemed pointless to use them. ...
    (microsoft.public.scripting.vbscript)
  • RE: Best Way to Auto Increment with Oracle
    ... environment and your session is not shared by anything else. ... you are threading (say in Java. ... to fetch a sequence, so you issue 'select seq.nextval from dual'. ... You then execute the insert statement. ...
    (perl.dbi.users)
  • Need help designing 2-3 queries
    ... I've got a simple site stat collection database consisting of 4 linked tables: ... Visitors - contains unique visitors for a given session ... When the visitor hits a page, I check the Page_visitor table, which allows me to avoid creating multiple records if the user visits the same page more than once during a given session. ... Hence, I have one visitor record per site-session, and one page_visitor record corresponding to each unique page the visitor has hit during that session. ...
    (microsoft.public.sqlserver.datamining)
  • Need some help designing 2-3 queries . . .
    ... I've got a simple site stat collection database consisting of 4 linked tables: ... Visitors - contains unique visitors for a given session ... When the visitor hits a page, I check the Page_visitor table, which allows me to avoid creating multiple records if the user visits the same page more than once during a given session. ... Hence, I have one visitor record per site-session, and one page_visitor record corresponding to each unique page the visitor has hit during that session. ...
    (microsoft.public.sqlserver)
  • Re: Go to Login Page when session expires
    ... Plus if I am typing in a long form and the 10 minutes hits, them whammo, my ... It would hit the server and keep the session ... > a period of time which is larger that your Session Timeout ... >> This javascript code, would I put this on each of my pages for my ...
    (microsoft.public.dotnet.framework.aspnet)

Quantcast