Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Global.asa Problem

    I have recently upgraded to IIS6 and was not experiencing these problems in
    IIS5. The global.asa reads:
    <SCRIPT LANGUAGE='VBScript' RUNAT='Server'>

    'EventName Description
    'Session_OnStart Runs the first time a user runs any page in your
    application
    'Session_OnEnd Runs when a user's session times out or quits your
    application
    'Application_OnStart Runs once when the first page of your application is
    run for the first time by any user
    'Application_OnEnd Runs once when the web server shuts down

    ' Global Variables
    'Dim Session("DB") ' Database Object
    'Dim Session("bLocal") ' Is a local client or not

    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''
    ' Main Subroutines
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''
    Sub Session_OnStart
    Set Session("DB") = Server.CreateObject("ADODB.Connection")
    Session("DB").Open("OSC")
    'CheckLocal
    End Sub

    Sub Session_OnEnd
    ******Session("DB").Close
    End Sub

    Where is **** is at is where the event log says there is a problem please
    help.

    Thanks,

    Tony


    Tony Guest

  2. Similar Questions and Discussions

    1. global groups problem
      Hi, I am not able to add global groups that I have recently created into other global groups, these too recently created. The problem is...
    2. global variable problem
      I want a counter progCounter to count the number of times that the frame is entered. Ultimately, I would like it to count the number of times that...
    3. Problem with global variables
      Hi All, I'm turning mad with global variables... In created a simple test script with 2 functions which worked fine but the other one i need...
    4. global.asax problem
      Hi all! I've created a simple aspx application and when I run it locally on my pc all works fine. If I move it on the web server I get the...
    5. global/screensaver problem
      If the frame <> 123 then ... do something the Label function returns the frame number for a given marker name: if the frame <>...
  3. #2

    Default Re: Global.asa Problem

    I don't know what you're specific problem is, but you shouldn't be opening
    and caching a connection in the session. You should be opening and closing
    it as required in your code - you're just wasting resources otherwise.
    You've probably used this approach because it looks nice and neat, but you
    can still achieve the same thing with some thoughtful coding without
    resorting to the spaghetti mess of connections and recordsets seen in a lot
    of ASP code.

    Food for thought.

    Cheers,

    Alan

    "Tony" <tony@optics.arizona.edu> wrote in message
    news:uy#QSTfYDHA.1280@tk2msftngp13.phx.gbl...
    > I have recently upgraded to IIS6 and was not experiencing these problems
    in
    > IIS5. The global.asa reads:
    > <SCRIPT LANGUAGE='VBScript' RUNAT='Server'>
    >
    > 'EventName Description
    > 'Session_OnStart Runs the first time a user runs any page in your
    > application
    > 'Session_OnEnd Runs when a user's session times out or quits your
    > application
    > 'Application_OnStart Runs once when the first page of your application
    is
    > run for the first time by any user
    > 'Application_OnEnd Runs once when the web server shuts down
    >
    > ' Global Variables
    > 'Dim Session("DB") ' Database Object
    > 'Dim Session("bLocal") ' Is a local client or not
    >
    >
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
    > '''''''''''''''''''''''''''''
    > ' Main Subroutines
    >
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''
    > '''''''''''''''''''''''''''''
    > Sub Session_OnStart
    > Set Session("DB") = Server.CreateObject("ADODB.Connection")
    > Session("DB").Open("OSC")
    > 'CheckLocal
    > End Sub
    >
    > Sub Session_OnEnd
    > ******Session("DB").Close
    > End Sub
    >
    > Where is **** is at is where the event log says there is a problem please
    > help.
    >
    > Thanks,
    >
    > Tony
    >
    >

    Alan Guest

  4. #3

    Default Global.asa Problem

    Don't waste any time looking into this. OLEDB does what
    you are trying to do under the covers. When you close a
    connection it is not actually closed but put into a pool,
    so if another process creates one and a suitable
    connection is in the pool it gets the pooled version.

    Doing what you are doing stops OLEDB managing the pool and
    OLEDB is doing a better job of it than your code is. What
    would happen when 1000 users all access your site? They
    get 1000 permanent connections, where if you let oledb
    handle pooling you will have all 1000 users serviced by
    maybe 5 or 10 connections instead.

    Open a connection in your code when you need it, and close
    it right after.
    >-----Original Message-----
    >I have recently upgraded to IIS6 and was not experiencing
    these problems in
    >IIS5. The global.asa reads:
    ><SCRIPT LANGUAGE='VBScript' RUNAT='Server'>
    >
    >'EventName Description
    >'Session_OnStart Runs the first time a user runs
    any page in your
    >application
    >'Session_OnEnd Runs when a user's session times
    out or quits your
    >application
    >'Application_OnStart Runs once when the first page of
    your application is
    >run for the first time by any user
    >'Application_OnEnd Runs once when the web server
    shuts down
    >
    >' Global Variables
    >'Dim Session("DB") ' Database Object
    >'Dim Session("bLocal") ' Is a local client or not
    >
    >''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''
    ''''''''''''''''''
    >'''''''''''''''''''''''''''''
    >' Main Subroutines
    >''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''
    ''''''''''''''''''
    >'''''''''''''''''''''''''''''
    >Sub Session_OnStart
    > Set Session("DB") = Server.CreateObject
    ("ADODB.Connection")
    > Session("DB").Open("OSC")
    > 'CheckLocal
    >End Sub
    >
    >Sub Session_OnEnd
    > ******Session("DB").Close
    >End Sub
    >
    >Where is **** is at is where the event log says there is
    a problem please
    >help.
    >
    >Thanks,
    >
    >Tony
    >
    >
    >.
    >
    Adrian Forbes - MVP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139