Global.asa

D

Dooza

Hi there,
I was provided a custom com object that is on a intranet webserver, its
a stocktake component that hooks into an ERP system called Streamline.
The sample code that was provided as in VB, and I managed to use it in
an ASP application.

During single user testing we didn't run into any problems, but when in
a multi-user environment we receive an occasional error. When I
contacted the vendor about this error, this is what I was told:

What I did in my VB program to get the error:
a click button with code - dimensioned the xacstocktake object at the
start of the click code (dim stocktake as xacstocktake) and called it as
an early bound object (set stocktake = new xacstocktake). Then I did two
updates (stocktake.UpdateStocktake). Once I hit the end of the sub, the
stocktake object was terminated (since it was defined in the sub). This
termination of the stocktake object shut down all tables, connections,
instances and sessions in the stocktake object. When I clicked on the
button again, I got the object variable error as the session for the
stocktake object had been terminated.

What I did in my VB program to NOT get the error:
The xacstocktake object was dimensioned at the start of the program.
The click button had pretty much the same code but as the xacstocktake
object was not defined in the click sub, it was not terminated when the
sub was completed. Next (and all subsequent) time I clicked on the
button, the update by the xacstocktake object was fine. I then
terminated the xacstocktake object when I unloaded the form.
-----------------------------------------------------------------------

This all makes sense if we were running an application, but we are doing
this via wireless barcode scanners that have IE, hence using ASP.

There are 2 calls to the object, one to validate the item being scanned,
and one to update the stocktake entry.

I use this at the start of each page that calls the object:
Dim macstocktake
Set macstocktake = Server.CreateObject("xacslappsexe40.xacstocktake")

And this at the end:
Set macstocktake = nothing

Can I put this in global.asa using Session_OnStart and Session_OnEnd?

Dooza
 
E

Evertjan.

Dooza wrote on 21 jan 2010 in microsoft.public.inetserver.asp.general:
There are 2 calls to the object, one to validate the item being scanned,
and one to update the stocktake entry.

I use this at the start of each page that calls the object:
Dim macstocktake
Set macstocktake = Server.CreateObject("xacslappsexe40.xacstocktake")

And this at the end:
Set macstocktake = nothing

Can I put this in global.asa using Session_OnStart and Session_OnEnd?

It seems to me that session_onstart does not make an object available to
individual pages, as it doesn't even make a simple variable available, and
why should it?

If you are too lazy to put thes three lines on each page that uses it,
why not use two serverside includes?
What I did in my VB program to NOT get the error

ASP dos not provide VB, only VBS, did you mean that?
There are 2 calls to the object, one to validate the item being scanned,
and one to update the stocktake entry.

The second one would not need to rescan, meseems,
but "validating an item" can mean lots of different things.
 
D

Dooza

Dooza wrote on 21 jan 2010 in microsoft.public.inetserver.asp.general:


It seems to me that session_onstart does not make an object available to
individual pages, as it doesn't even make a simple variable available, and
why should it?

No your right, upon closer inspection of global.asa I can define an
object with a session scope to make it available throughout the application.
If you are too lazy to put thes three lines on each page that uses it,
why not use two serverside includes?

Its not I am too lazy, its that the COM object doesn't like to be
terminated until the session has finished.
ASP dos not provide VB, only VBS, did you mean that?

That was the reply from the vendor, and it was VB. The vendor created
this custom component for the ERP system. They provided really bad
documentation and a demo VB application. They said an ASP application
could easily be created using this, which I have done.

They were successful at getting there VB program make the same error
message that my ASP application was getting. They prevented the error
from happening by not creating/closing the object for each scanned item
(item being a real thing in the warehouse that is part of the stocktake)
The second one would not need to rescan, meseems,
but "validating an item" can mean lots of different things.

Yes, it can, and my case it checks whether the item is part of the
current stocktake, is an active item, does or does not have a batch code
and the batch code is correct. It also checks if this item has already
been scanned for the current location, if it has, when you do part 2,
the update, you tell to either update the existing count, or add to it.

Its a pretty complex procedure which is why the vendor create the
component for us.

I guess I just need to know if my logic of having the object in
global.asa is a good idea.

Steve
 
B

Bob Barrows

Dooza said:
I guess I just need to know if my logic of having the object in
global.asa is a good idea.
Unless the object is configured to be free-threaded, then the answer is a
decided "no". Using a thread-bound object in Session or Application will
drastically reduce the scalability of your application. See:
http://www.aspfaq.com/2053
 
D

Dooza

Unless the object is configured to be free-threaded, then the answer is a
decided "no". Using a thread-bound object in Session or Application will
drastically reduce the scalability of your application. See:
http://www.aspfaq.com/2053

Hi Bob, this is just the information I need to know. I will check with
the vendor to see how they coded it. I doubt they have made it this way,
and may just need to accept that we get errors every now and then.

Cheers!

Steve
 
D

Dooza

Unless the object is configured to be free-threaded, then the answer is a
decided "no". Using a thread-bound object in Session or Application will
drastically reduce the scalability of your application. See:
http://www.aspfaq.com/2053

Hi Bob,
The vendor didn't get back to me, so I went ahead and did some testing
with a our test server and have not had any problems. It would appear
that the component was configured to be free-threaded. We have had 5
clients doing a dummy stock take and not had any errors. We plan to use
15 on the day, but are ready to roll back to the previous version if we
start getting any problems.

Your links gave me some good reading, so I appreciate your help in this
matter.

Cheers,

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top