Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...