R
Rory Becker
I have had code in my Application_Start which is intended to run once at
the start of my application's life.
It loads connection information and similar from a known location.
However I recently migrated my app using
-------------------------------------------------------------
%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/YourApp"
-------------------------------------------------------------
At which point my app's startup code was denied access to the request object.
I found a workaround which was to place the following code in the beginrequest
-------------------------------------------------------------
Private Shared InitializeLock As New Object
Private Shared InitializedAlready As Boolean
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
SyncLock InitializeLock
If Not InitializedAlready Then
' My Initialise code goes here.
InitializedAlready = True
End If
End SyncLock
End Sub
the start of my application's life.
It loads connection information and similar from a known location.
However I recently migrated my app using
-------------------------------------------------------------
%systemroot%\system32\inetsrv\APPCMD.EXE migrate config "Default Web Site/YourApp"
-------------------------------------------------------------
At which point my app's startup code was denied access to the request object.
I found a workaround which was to place the following code in the beginrequest
-------------------------------------------------------------
Private Shared InitializeLock As New Object
Private Shared InitializedAlready As Boolean
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
SyncLock InitializeLock
If Not InitializedAlready Then
' My Initialise code goes here.
InitializedAlready = True
End If
End SyncLock
End Sub