Global.asa

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
     
    Dooza, Jan 21, 2010
    #1
    1. Advertising

  2. Dooza

    Evertjan. Guest

    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.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 21, 2010
    #2
    1. Advertising

  3. Dooza

    Dooza Guest

    On 21/01/2010 13:13, Evertjan. wrote:
    > 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?


    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.

    >> What I did in my VB program to NOT get the error

    >
    > 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)

    >> 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.


    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
     
    Dooza, Jan 21, 2010
    #3
  4. Dooza

    Bob Barrows Guest

    Dooza wrote:
    > 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

    --
    Microsoft MVP - ASP/ASP.NET - 2004-2007
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows, Jan 21, 2010
    #4
  5. Dooza

    Dooza Guest

    On 21/01/2010 16:25, Bob Barrows wrote:
    > Dooza wrote:
    >> 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


    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
     
    Dooza, Jan 21, 2010
    #5
  6. Dooza

    Dooza Guest

    On 21/01/2010 16:25, Bob Barrows wrote:
    > Dooza wrote:
    >> 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


    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
     
    Dooza, Jan 25, 2010
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darlene Gauthier

    PostRequestHandlerExecute event in global.asa

    Darlene Gauthier, Jul 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,449
    Karl Seguin
    Jul 23, 2003
  2. Kevin Spencer

    Re: global.asa file (count sessions)

    Kevin Spencer, Jul 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    368
    Kevin Spencer
    Jul 30, 2003
  3. DevBoy

    Global.asa File ?????

    DevBoy, Aug 12, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    372
    Rick Strahl [MVP]
    Aug 13, 2003
  4. Wayne
    Replies:
    2
    Views:
    499
    Wayne
    Nov 11, 2003
  5. Raghu
    Replies:
    1
    Views:
    4,151
    Raghu
    Feb 17, 2005
Loading...

Share This Page