goofy global.asa

G

Giorgio

Hi all,
i have a problem with a website where i use asp 3 and a global.asa in the
root.
In global.asa i use some aaplication variables which contains strings, such
as: Application("str1")="text".
Sometimes (even if i dont change the code) application variables becomes
null
To solve the problem i delete from server my global.asa and upload new one
(with same code inside)
Provider says their servers are all right
how can i fix it?

Thanx
 
G

Giorgio

What did they tell you in the ASP newsgroup...?

which one?
i posted to an italian ng but i didn't get any answer
is there any other?
 
J

Juan T. Llibre

If your Application variables are "evaporating" occasionally,
you can reset them, and make sure they do exist, by using an include file:

Include this "test_app_vars.inc" in your pages :

<% language="vbscript" RUNAT=SERVER %>
<%
If Application("str1") = "" Then
'this runs f the variables have been lost
Application.Lock 'Lock App while you reset
Application("str1") = "whatever that variable is"
Application("str2") = "whatever"
Application("str3") = "something else"
Application.Unlock
End If
%>

That will assure you that even if the variables are "lost", by anything your
provider has misconfigured, your variables will be available for your use
in any page in which you include "test_app_vars.inc".
 
G

Giorgio

That will assure you that even if the variables are "lost", by anything
your
provider has misconfigured, your variables will be available for your use
in any page in which you include "test_app_vars.inc".

Thanks (for the ng address also).
Doing so, i have to put the include in any page, so i could even not use
global.asa anymore, but include file only.

The strings are connection strings to several databases, so i use these
strings in a lot of pages and global.asa was so usefull cause in the pages i
don't have to write code
 
G

Giorgio

Are you setting this variable in the Application_OnStart event?
I suspect your application was restarted and that is why
you are losing the value. This event fires when the application
starts back up.

Thanks.
Yes, i set them in that event.
Does not this event fire when any page is accessed first time by first
client?
So, also if it had been "resetted", when first client access a page the
string should be avalaible, isn't it?

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Option Explicit

Sub Application_OnStart
Application("str1") = "text"
End Sub

Sub Application_OnEnd
'end
End Sub

Sub Session_OnStart
'start
End Sub

Sub Session_OnEnd
'end
End Sub
</SCRIPT>
 
J

JessicaL

Hello! Is there a better seller of event tickets than ticketmaster?
I really need this info..Thanks :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top