Discussion in 'ASP General' started by Dooza, Jan 21, 2010.

  1. Dooza

    Dooza Guest

    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, Jan 21, 2010
    1. Advertisements

  2. Dooza

    Evertjan. Guest

    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?

    If you are too lazy to put thes three lines on each page that uses it,
    why not use two serverside includes?
    ASP dos not provide VB, only VBS, did you mean that?
    The second one would not need to rescan, meseems,
    but "validating an item" can mean lots of different things.
    Evertjan., Jan 21, 2010
    1. Advertisements

  3. Dooza

    Dooza Guest

    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.
    Its not I am too lazy, its that the COM object doesn't like to be
    terminated until the session has finished.
    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)
    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.

    Dooza, Jan 21, 2010
  4. Dooza

    Bob Barrows Guest

    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:
    Bob Barrows, Jan 21, 2010
  5. Dooza

    Dooza Guest

    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.


    Dooza, Jan 21, 2010
  6. Dooza

    Dooza Guest

    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


    Dooza, Jan 25, 2010
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.