473,783 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global.asa does not fire after reboot until re-saved.

Hi Guys

I have been working with ASP for many years but have _never_ come across
this. Sure, I've had the global.asa not execute because of application
misconfiguratio n, but check this out...

Server (W2K3 R2) reboots, website comes back up, but no application
variables loaded.

What makes it even more bizarre is that the variables that are set in
Application_OnS tart _are_ loaded, like the connection string, but others
that are loaded by calling other subroutines are not. For example, below
the SITE_ID and NODE_ID and Connection String variables are set and are
accessible on other ASP pages, however anything that is set via the
InitAppVars subroutine are not set (see below).

Rebooting the server makes no difference. Saving the global.asa causes the
application to load _all_ the variables again properly. How wierd is that?
Could it be something to do with application locking?

Thanks in advance

David
<SCRIPT LANGUAGE=VBScri pt RUNAT=Server>
Const SITE_ID = 1
Const NODE_ID = 0
Server.ScriptTi meout = 300
Sub Application_OnS tart
Application("Da tabase_Connecti onString") =
"Provider=SQLOL EDB.1;Password= password;Persis t Security Info=True;User
ID=sa;Initial Catalog=SiteCon trol;Data Source=192.168. 0.100;Use Procedure
for Prepare=1;Auto Translate=True; Packet Size=4096;Works tation ID=X;Use
Encryption for Data=False;Tag with column collation when possible=False; User
Id=sa;PASSWORD= password;"

Application("SI TE_ID") = SITE_ID: Application("NO DE_ID") = NODE_ID
Application("Da tashape_Connect ionString") = "Provider=MSDat aShape.1;Data "
& Application("Da tabase_Connecti onString")

InitAppVars

End Sub

Sub InitAppVars

Dim objConn, objRs
Set objConn = Server.CreateOb ject("ADODB.Con nection")

On Error Resume Next
objConn.Open Application("Da tabase_Connecti onString")

If Err Or objConn.State <adStateOpen Then
Err.Raise Err.Number, Err.Source, "The Web Site's Database could not be
opened.<br>" & Err.Description
Exit Sub
End If
On Error Goto 0

Set objRs = Server.CreateOb ject("ADODB.Rec ordSet")
objRs.Open "tblAppVars ", objConn, adOpenForwardOn ly, adLockReadOnly,
adCmdTable
If Not objRs.EOF Then
With objRs
Do While Not .EOF
Select Case UCase(.Fields(3 ).Value)
Case "STR"
Application(.Fi elds(1).Value) = .Fields(4).Valu e
Case "LNG"
Application(.Fi elds(1).Value) = CLng(.Fields(4) .Value)
Case "DBL"
Application(.Fi elds(1).Value) = CDbl(.Fields(4) .Value)
Case "BOL"
Application(.Fi elds(1).Value) = CLng(.Fields(4) .Value) <0
End Select
.MoveNext
Loop
End With
End If
objRs.Close
Set objRs = Nothing
objConn.Close
Set objConn = Nothing
End Sub
Nov 9 '07 #1
2 2358
David Morgan wrote:
Hi Guys

Sub Application_OnS tart
InitAppVars

End Sub

Sub InitAppVars

Dim objConn, objRs
Set objConn = Server.CreateOb ject("ADODB.Con nection")

On Error Resume Next
objConn.Open Application("Da tabase_Connecti onString")

If Err Or objConn.State <adStateOpen Then
Err.Raise Err.Number, Err.Source, "The Web Site's Database could not
be opened.<br>" & Err.Description
Exit Sub
End If
1. You don't seem to be doing anything with this error. At the leatst, you
should be logging it somewhere so you can see if your problem is caused by
an inability to connect to sql.

2. Have you tried taking the code out of the sub and putting it directly
into onstart? I know it should not be necessary, but doing so migh yield a
clue.
--
Microsoft MVP - ASP/ASP.NET
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"
Nov 9 '07 #2

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcomwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
David Morgan wrote:
>Hi Guys

Sub Application_OnS tart
InitAppVars

End Sub

Sub InitAppVars

Dim objConn, objRs
Set objConn = Server.CreateOb ject("ADODB.Con nection")

On Error Resume Next
objConn.Open Application("Da tabase_Connecti onString")

If Err Or objConn.State <adStateOpen Then
Err.Raise Err.Number, Err.Source, "The Web Site's Database could not
be opened.<br>" & Err.Description
Exit Sub
End If

1. You don't seem to be doing anything with this error. At the leatst, you
should be logging it somewhere so you can see if your problem is caused by
an inability to connect to sql.

2. Have you tried taking the code out of the sub and putting it directly
into onstart? I know it should not be necessary, but doing so migh yield
a clue.
--
Microsoft MVP - ASP/ASP.NET
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"
Hi Bob

Thanks for your reply.

1. Err.Raise in the Global.asa will halt the app. I have no need to log as
I will have 1000 emails telling me the site is down, if I don't find out
myself.

2. As mentioned above, saving it having made no changes appears to have
fixed it.

Will keep you informed.
Nov 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1331
by: Ted Dawson | last post by:
Last week I was storing my variables in a database and retrieving them on every page of my application, but this week I want to retrieve them only once and store them in an application variable. This works, but if I have to change one of the variables, the application variable remains unchanged until the web server is restarted, thus re-firing global.asa. Is there a way to force global to fire again, refreshing my variables?
4
406
by: Bill | last post by:
So when *does* Session_OnEnd fire in my Global.asa file? Does it fire when they click a link to leave the site? Does it fire when the session times out?
4
11964
by: Max | last post by:
I've noticed some procedures don't run in the global.asax when you'd expect them to. I've rebuilt and set break points, but Application_Start just isn't firing today. Is there some configuration that prevents this from happening? I've never gotten Session_End to fire either. -M
4
2315
by: jzink | last post by:
I need to update a sql table with the last date/time that a user logged into my web site. The site is protected via integrated authentication. I can put code in the global.asax file to update when a user hits any page in the site. Is there any code I can put in to capture if a user tries to access a .PDF file in the web site ? For example the user can open a broswer and request http:\\mywebsite\application1\test.pdf. This action does...
2
5210
by: Nathan Sokalski | last post by:
I would like to access variables and functions that I declare in the Global.asax.vb file. However, I am having trouble doing that. What does the declaration have to look like in the Global.asax.vb file, and what would I do to access it? (I am using VB.NET for my code) Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
37
3988
by: Joshua Ruppert | last post by:
When I'm using FastCGI do I need to code differently than I do when using regular CGI? Because the PHP.exe processes don't go away do global variables stick around from page request to page request, creating the need for better managment / pooling of DB connections? Josh
8
5770
by: Roger | last post by:
When I call the session.abandon() method, it calls the session_end event. When a user closes the browser or clicks the log off button, I can dispose of objects and abandon the session cleaning. But, when a user either navigates away from the web app and when the session timesout, the session_end event does not seem to fire. Or when else can I dispose of objects? Or is there an event I can you that is fired when a user navigates away from...
12
10701
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I am trying to maintain a list of people who are currently "online" in SQL. I do this by adding a simple entry to a simple PeopleOnline table whenever someone logs in to my site. If they manually log OUT of the site, I have no problem deleting them from the PeopleOnline table. But if they just close the browser, I was assuming I'd have to use the Session_End() event in Global.asax even though I know that this will only occur once the...
1
995
by: Nikolai | last post by:
What is the DOS file I need to edit to fire up executables? I know this is a really basic question, but I cannot figure it out; I even googled it, but no dice. I use old Word Perfect 5.1 for Medical Transcription, and I need prd (which is a macro program) and other programs to fire up when I reboot. Right now I have to reboot and then go into DOS and manually enter the exe names which is lame. Thx!
1
2346
by: daonho | last post by:
Hi Everyone, I have encountered this problem that I am not able to figure out. Please drop me some lines if you have any idea how to solve this issue. I have a global.asax file in my web site. It works fine as I wanted when loading aspx file; however, I have some static page in the same directory such as html and htm page. These page also load correctly and the global.asax file does fire when executing my .net development environment....
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.