global.asa and global.asax file?

I have two files in visual source safe one with global.asa
and the other global.asax,global.asax.res, global.asax.vb.

The global.asa contains the following:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

' C.C. Financial Evaluation Model global.asa
' Copyright 2001 Zurich North America
' Corporate Customer

'You can add special event handlers in this file that will get run automatically when
'special Active Server Pages events occur. To create these handlers, just create a
'subroutine with a name from the list below that corresponds to the event you want to
'use. For example, to create an event handler for Session_OnStart, you would put the
'following code into this file (without the comments):

'Sub Session_OnStart
'**Put your code here
'
'**
'End Sub

'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

Dim aDBParams()
Dim aEntParams()
Dim sRegSetting
Dim objRegRead
Dim nParamCnt
Dim nEntCnt
Dim nLoopCnt

Function ParseString (SubStrs, argSrcStr, Delimiter )

      ' Dimension variables:
      ReDim SubStrs(0)
      Dim CurPos
      Dim NextPos
      Dim DelLen
      Dim nCount
      Dim TStr
      Dim SrcStr

      ' Add delimiters to start and end of string to make loop simpler:
      SrcStr=argSrcStr
      SrcStr = Delimiter & SrcStr & Delimiter
      ' Calculate the delimiter length only once:
      DelLen = Len(Delimiter)
      ' Initialize the count and position:
      nCount = 0
      CurPos = 1
      NextPos = InStr(CurPos + DelLen, SrcStr, Delimiter)

      ' Loop searching for delimiters:
      Do Until NextPos = 0
         ' Extract a sub-string:
         TStr = Mid(SrcStr, CurPos + DelLen, NextPos - CurPos - DelLen)
         ' Increment the sub string counter:
         nCount = nCount + 1
         ' Add room for the new sub-string in the array:
         ReDim Preserve SubStrs(nCount)
         ' Put the sub-string in the array:
         SubStrs(nCount) = Trim(TStr)
         ' Position to the last found delimiter:
         CurPos = NextPos
         ' Find the next delimiter:
         NextPos = InStr(CurPos + DelLen, SrcStr, Delimiter)
      Loop

      ' Return the number of sub-strings found:
      ParseString = nCount

   End Function
 

' Use Application variables since they do not change from session to session
Sub application_OnStart()
Dim sDBParams()
Dim sEntParms()
Dim sRegSetting
Dim objRegRd
Dim nParmCnt
Dim nEntCnt
Dim nLoopCnt
    Application.Lock
    ' =========> ChannelZ Home page <=================
    'Development Server
         application("ChannelZSvr") = "http://chzdev.zurichna.com
    'Staging Server
            'application("ChannelZSvr") = "http://chzstaging.zurichna.com
        'Prod Server
        'application("ChannelZSvr") = "http://chz.zurichna.com

    ' =========> IIS Home page <=================
    'Dev Server
        application("IISHomeURL") = "http://chzdev.zurichna.com
    'Staging Server
            '*application("IISHomeURL") = "http://chzstaging.zurichna.com
        'Prod Server
        '*application("IISHomeURL") = "http://chz.zurichna.com

    ' =========> Enterprise Risk Home page <=================
    'Dev Server
          application("Ent_Risk_Home") = "http://zaiadev.zurichna.com
     '' application("Ent_Risk_Home") = "http://172.16.232.73:9030" Cutover

    'Staging Server
        'application("Ent_Risk_Home") = "http://zuserstg.zurichna.com
    'Prod Server
        'application("Ent_Risk_Home") = "http://zuser.zurichna.com

    ' =========> Enterprise Risk WEB Paths used by Financial Model <=================
    '--> Applications Home Page
    Application("applications_home_page_path") = "corporate_customer/applications"

    '--> Financial Model directory structure
    Application("financial_model_path") = "corporate_customer/applications/financial_evaluation_model"

    Application.Unlock

    ' =========> Enterprise Risk Application Variables used by Financial Evaluation Model <=================
    ' =========> These are used by the reporting section <=================
    ' the following applications variables are initialized from the registry of the server
    'DataBase Server Name = Application("Data Source")
    'DataBase Name = Application("Initial Catalog")
    'userid for reporting = Application("User Id")
    'Password for reporting userid = Application("Password")
    ' see file regcom.reg for setup of registry entry

    set objRegRead = server.CreateObject("ZUSER_FinMRdRegKy.clReadReg")
    sRegSetting = objRegRead.ReadReg("ZUSER_FinM","Database","Connect")

    nParamCnt = ParseString(aDBParams,sRegSetting,";")
    for nLoopCnt = 1 to nParamCnt -1 step 1
            nEntCnt = ParseString(aEntParams,aDBParams(nLoopCnt),"=")
            if nEntCnt = 2 then
                Application.Lock
                Application(aEntParams(1))= aEntParams(2)
                Application.Unlock
            end if
    next

    sRegSetting = objRegRead.ReadReg("ZUSER_FinM","Database","ReportsDSN")
    set pobjRegRead = Nothing
    nParamCnt = ParseString(aDBParams,sRegSetting,";")
    for nLoopCnt = 1 to nParamCnt -1 step 1
            nEntCnt = ParseString(aEntParams,aDBParams(nLoopCnt),"=")
            if nEntCnt = 2 then
                Application.Lock
                Application(aEntParams(1))= aEntParams(2)
                Application.Unlock
            end if
    next

   ' =========> Domino Web servers <=================
    'Dev Server
        Application.Lock
             application("DominoHomeURL") = "http://usznalpha2.zurichna.com
    'Staging Server
        'application("DominoHomeURL") = "http://usznbeta2.zurichna.com
    'Production Server
        'application("DominoHomeURL") = "http://usznweb2.zurichna.com
     
    Application.Unlock
     
End Sub


</SCRIPT>



and this is the global.asax.vb:

=====================

Imports System.Web
Imports System.Web.SessionState
Imports clsRegistryRead
Public Class Global
    Inherits System.Web.HttpApplication

#Region " Component Designer Generated Code " 

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
    End Sub

#End Region

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
        Dim rReg As New clsRegistryRead.FinMod_RegistryReader()
        Application("ConnectString") = rReg.GetCurrUserRegistryValue(".Default\Software\VB and VBA Program Settings\ZUSER_FinM\Database", "Connect")
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session is started
    End Sub

    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires at the beginning of each request
    End Sub

    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires upon attempting to authenticate the use
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when an error occurs
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session ends
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application ends
    End Sub

End Class


Which one is being run when the default.asp page is being loaded?

mathieu_cuprykAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcgantsCommented:
Global.asax is the .NET equivalent of the Classic ASP Global.asa file.
Have you converted the app from an ASP3.0 file?
If you are using ASP and ASP.NET files, the ASP.NET pages, the ASP.NET pages call the global.asax file.

For more information on the changes, check out:
http://aspalliance.com/articleViewer.aspx?aId=440&pId=

hope this helps,
mcg
mathieu_cuprykAuthor Commented:
There are aspx pages and asp pages so what happens in this case?
mcgantsCommented:
Sorry, fell short of explaining that didn't I?!
The aspx pages reference the Global.asax whereas the asp pages reference the global.asa file.
The reason is that although ASP/ ASPX pages can be used side-by-side, application and session state are not shared between them.

mcg

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mathieu_cuprykAuthor Commented:
Cool!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.