Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Database In Global.asa


I came across a site of a customer which worked with an access database. In the global.asa 9in the stat_session function),the database was opened, instead of in each seperate asp file which needed database results. Now,I see one disadvantage allready here: the database is never closed during the time the session lasts.

My method of working is that i work with several databases, so I figure I can better not open all the databases at once in the global.asa file.I normally don't either; I just open the database on the beginning of the asp which needs the results or needs to write to the database or update it, and then simple close it at the end. Now I'm wondering, what's the best method? Which one is less cpu usage extensive/which one works the fastest?




View Complete Forum Thread with Replies

Related Forum Messages:
Global.asa And Database Connections..
On everyone of my pages I have an a include page at the top and at the bottom of the page

one is the database connection and one is for the database disconnection.

is there anyway I can automaticly connected to the database using a string without adding it to every page ?

I checked in IIS and I can add a footer but not a header, or anyway using global.asa file

View Replies !
Set Session Var In Global.asa From Database
CAn I set a session variable dynamically based on a value in a database and use the global.asa to do it...

View Replies !
Global.asa Connecting To Database
what I am trying to do it set a logout time on a control panel for those times when a user forgets to hit "logout" button. Based on some examples I have been looking at I have done the following, can I just get your feedback in terms of whether this will work ok?

Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
logoutcheck
Application.UnLock
End Sub

sub logoutcheck....

View Replies !
Update A MS Access Database From Global.asa
If you can help me to update a table entry from global.asa on session end ...

View Replies !
Global.asa
I need to Ban IP's on my IIS server. I know the IP's I need to ban, but how to I write the global.asa file correctly.

View Replies !
Global.asa
i created a global.asa file with notepad and put it in the root directory

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Session_onStart()
session("mary") = "mary"
End Sub

</SCRIPT>
now in my asp code i put <%=session("mary")%>

and restarted my machine, and check the value of mary and there was none whats wrong here?
I didnt put a reference in my asp page to the global.asa file. I assume asp looks for it itself ?

View Replies !
Global.asa
Do I need to do a Application_onstart first then i can do Session_onstart?? or it doesnt matter which one is used b4 which one? When i use a global.asa, do i need to call it within my asp page to execute it or will it be auto started and execute?

View Replies !
Global.asa
i just started learning what it can do, and I am using it to tracj how many people have logged into my site, but when people login to my site, I start 2 sessions, one for their ID, and one for their name. Is there any way to only count the name session as a session_onstart in global.asa?

View Replies !
Global.asa
im tryin to secure my application. i want the application to send the user back to the login page if they have not logged into the system. do i use the global.asa file or is there a simpler way to do this?

View Replies !
Global Asa
I am trying to put a condition in my Global.asa file based on the server
name.the reason, I want to set a global string as a application variable based on
the server I am on.
I also need to set a coonection string based on the value of the server.
I need to use this connection string to retrieve values from an sp in
application on start that sets a load of global variables so I can't really
do this anywhere else.

View Replies !
Global.asa
i have a problem with the global.asa.I have a session variable. I set the contain in a.asp and try to get it in B.asp
I'm able to have the contain in a.asp but in B.asp It's impossible.


View Replies !
Global.asa
Is it possible to retrieve a value from a variable in an .asp page in Global.asa?

View Replies !
Global Asa
I have a site which until this morning, was on a remote server. The structure was that the "site" was actually a folder on the server, as I am designer and use this arrangement to develop sites. Under the root directory, I had modified the global asa file to include session variables. Ok, so I download the site (folder) to my hard drive, and put it in the folder of "MY Documents" called MyWebs. I then opened VB Studio and created a new solution, which is pointing to the before mentioned directory in My Documents. When I pull the site up in IE, the session variables were not being called, and I realized I had not copied over the asa file. So I did so, placing a copy of it in the hard drive's c inetpub wwwroot directory, and also directly in the my docs mywebs directory,and the site's directory as well. It seems it is still not being called.Can anyone tell me what I am doing wrong?

View Replies !
Global.asa!
Is the Global.asa file resolved before parsing the 'Include' (files) or
after parsing the 'Include' (files)?

View Replies !
Global.asa
Is there any chance my server doesn't support global.asa files?
(It supports ASP)

View Replies !
ASP, GLOBAL.ASA
I have IIS 5.0 installed on for a test server. the global.asa file runs perfectly.

when tryng the same application on win server 2003 IIS 6.0 the global.asa does not fire. i have set the application as a virtual site and given rights for iwam and iusr. What else could be the problem. Code:

View Replies !
Global.asa
My global.asa is not being called.. any idea what may be the problem

View Replies !
Global.asa
I have added a db driven marquee to my site and need to combine the global asa's to 1 global asa file. Code:

View Replies !
Global.asa
In Global.asa I have mentioned two sub routines 1> Session_OnStart and
2>Application on Start but both of them are not at all initiated when I restart IIS.

Please Tell me why is this happening, I have tried ever ....

View Replies !
Global.asa
I wrote global.asa file but I couldn't get what I expect.After user logs on to the system,if he/she directly closes the explorer,the time he/she logs out must be written to the database.I have logout.asp file which do this when the user click on the LOGOUT button,but if the user doesn't click it just closes the explorer what handles it??The following global.asa tries to do that but I think there is something wrong.If you examine it I would be very happy thanks...

GLOBAL.ASA

<script language=vbscript runat=server>
Sub Application_OnEnd()
session.abandon()
End Sub
Session.Timeout=1
Sub Application_OnStart()
Application("CurrentUser")=0
Application("TotalUser")=0
End Sub
Sub Session_OnEnd()
Application("CurrentUser")=Application("CurrentUser")-1
Application("TotalUser")=Application("TotalUser")-1
Set con = Server.CreateObject("ADODB.Connection")
con.Open "DSN=Address"
SQL="UPDATE tblLog SET fldTimeOut= "' & Time() & "' WHERE fldUserName= "' & Session("Admin") & "'"
con.execute(SQL)
session.abandon()
con.close
End Sub
Sub Session_OnStart()
Application("CurrentUser")=Application("CurrentUser")+1
Application("TotalUser")=Application("TotalUser")+1
End Sub
</script>

View Replies !
GLOBAL.ASA And IIS 6.0
How does IIS 6.0 treat the global.asa file? I had the following problem;

1. uploaded a new site to the win3k server

2. had incorrect db connection string in Session_OnStart in global.asa and website caused errors.

3. Changed the global.asa file to include the correct details. Saved the file. Still got the same errors.

I could not resolve this unless restarting the WWW Service on this server. In IIS 5.0 the global.asa file would reload after resaving it (as the timestamp is updated).

I even waited the next day before restarting the service because I though Session_OnStart expires after my session ends...but the error was still there
in the morning.

Hopefully someone will make sense of it for me. Here is the code (I inherited) in the global.asa

Sub Application_OnStart
Application("DB.ConnectionString")= ""
Application("MaxLoginAttempts") = 5
Set Application("Con") = Server.CreateObject("ADODB.Connection")
Session("Test") = Now()
End Sub

Sub Session_OnStart....

View Replies !
Global.asa
I have written general purpose functions in an .inc file when I include that file using #include to my global.asa I get errors. whats the correct way to include that .inc file in global.asa.

View Replies !
Global.asa
My global.asa is not working. Iam using win xp and visual studio 2003 to develop the application.I just wonder why. The copy of the global.asa copy to another application is worked fined.

View Replies !
Global.asa
I have just started developing a shopping site and I have a problem.I am using Win XP Pro's IIS to test my asp pages.I couldn't see global.asa in root directory and put it there

On session start I set the session("test")="test" to test if global.asa is working however as I run the asp page I couldn't see the test written on page

Why global.asa is not working?Isn't Win XP Pro a good platform to test the asp pages?

View Replies !
Global.ASA
I have an application that loads an array in the global ASA file.Sometimes that array gets lost for no real reason, resulting in a ubound error. MS has a solution which involves removing virus-scanning and backup procedures.which is not an option.is there ANY way to force the Global.ASA to relaod that array? Currently I have to go in and edit the global.asa,add a few spaces and then backspace and save and it causes a reload.

I could easily check if the variable exists, but if it does not I do not know where to go.

View Replies !
Global.asa
Im running windows 2000 server and i have copied an old site into the folder Site1 in the wwwroot i.e.

wwwroot/site1.

I have made a new text file called global.asa in it bit it doesnt seem to work, here's whats inside:

Sub Application_OnStart
Application("varDate") = "21"
End Sub


I have put this is the .asp file in my old site and nothing is printed:
<%
Response.Write Application("varDate")
%>

Have i done something wrong or not set something up?

View Replies !
Global.asa
I have one IIS 6 machine that seems to ignore global.asa completely. I can't get *anything* to fire -- not Session_OnStart(), not typelib declarations. This is true in the web root as well as in any application folder.

In particular, this is preventing me from loading the ADO 2.8 type library,but I cannot even force an error by using a malformed GUID.This is my only machine that appears to have this problem.

View Replies !
Global.asa
May I know if there's any known issues or problems when using a global.asa file for an ASP application in IIS 5.0?

View Replies !
ADO In Global.asa
Is it possible to use ADO in global.asa?I simply want to creat a log of each visit to the site?

View Replies !
Global.asa
I placed my global.asa file into a subfolder in the wwwroot folder. It doesn't seem to work when I try to use the sessions that have been declared there.

View Replies !
GLOBAL.ASA
Will IIS6.0 recognize a global.asa file located in a subdirectory on the webserver?

I'd like a file that will execute whenever a file in the subdirectory is browsed - or, at least it is executed the first time a file in the subdirectory is browsed.

View Replies !
COM And Global.asa
I created a dll to track our users and I want to call it in the Global.asa. How do I do this? I've seen the <OBJECT> tag to create an object, but I'm not sure how to use it correctly.

View Replies !
Global.asa
i have iis on my comp. the global.asa file works for one folder while it does not for another. And when i uploaded the file that works onto my web hosting company's server, it does not work. the global.asa file that works on my comp does not work on the www.

View Replies !
Global.asa
I am currently in the process of designing an ASP online shopping store site. When a new session is started on the web server, the global.as file is executed which creates a database connection to generate a "shopper ID" and "basket ID" for the new user. These are then returned and stored in a session variable.

I don't want my access database becoming too large, because as more and more users arrive at the site more and more shopper IDs will be being generated. I know that you can add a Subprocedure (Sub_SessionOnEnd) into the global.asa file that could remove that user from the database, but does this execute only when the user closes their browser or when the server thinks the session has ended?

If it is when the server thinks the session has ended, does anyone have any other
way of doing this when the user closes their browser, or do you think I should clear
the database out manually.

View Replies !
Global.asa
What i'm trying to do is delete away some rows of data in a database when a session ends. The codes are shown below. The problem is why the the database dont get deleted even after i set the timeout to 1 (waited for more than 1 minute) or after the script called the Session.Abandon? Code:

View Replies !
Global.asa
I have one application folder containing all ASP code files. I want host multiple sites pointing to same code. Can I do this ? If YES then how I can assign diffrent global.asa to each application...

View Replies !
Global.asa
I started working with the global.asa file recently And I have som problem.

I was able to set a application variable in the global.asa and also retrive it from an ASP file that is in the root directory. The problem is that if that ASP file is in a subdirectory then the application variable is empty.

Is application variables are only transfred in one dir?

View Replies !
Global.ASA Reg.
I dont have any idea about Global.asa. Is it for global variable declarations?

View Replies !
How To Use Global.asa
i'm a little bit confused with using application_onstart.. as u can see in the following code... my DB connection and SQL statements is currently included in my application_onstart event.. but, unfortunately, i wasn't able to reference Application("sUser") in my asp when i tried to run my website Code:

View Replies !
Global Changes To SQL
We have over 100 asp pages that reference a table (distribution_components). We added a new column and primary key to that table, so now we have to modify the where clause to include that column (we have to make the new column = to a session variable in the page)

The table appears 531 times in our code. Is there some util or method that allows us to change it globally, other than going to each occurrance, and adding the new column to the where clause.

View Replies !
Global Session_Onend
Basically session_onend will not fire in my global.asa files! I have just made a very simple test to prove its not my programming and it still doesnt fire.
Session_onstart works a treat but onend will not work even if you force the session to expire with abandon. I have tried on 2 of our servers now and it doesnt work on either.

my simple test is this:

Sub Session_OnEnd
application("test") = "hello"
End Sub

Now surely that should work. i obviously have a page that writes that test variable to the page but its always empty.

View Replies !
Cookies In Global.asa
Set IE 6.0 ver. X to "Block all Cookies" in privacy settings and try
this code in three separate files.

<-- Global.asa -->
sub Session_OnStart
response.cookies("test") = "-1"
end sub
<-- Global.asa -->

<-- testcookie1.asp -->
<%Response.Redirect("testcookie2.asp")%>
<-- testcookie1.asp -->

<-- testcookie2.asp -->
<%=request.cookies("test")%>
<-- testcookie2.asp -->

I get "-1" on testcookie2.asp

Anyone else get the same result?
Why am I getting the cookie in this test?

View Replies !
Global.asa And Session_OnEnd
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?

View Replies !
Global.asa Session_OnEnd
I have an ASP application that is a electronic purchase orders system. My
problem is that only 3 people can authorise a purchase order. When a
purchase order is selected I update the table to show that the field is
locked. If they complete the form then the database is updated and the lock
is removed, all though at this stage the record moves into another part of
the system and the lock becomes redundant.
If however they dont complete the form the record is left in a permanent
locked state, it could be that they decided to look at the record then
navigated away or closed the browser.
So i thought maybe i could stick some code that updates the database into
the session_OnEnd in the global.asa, so after 20 minutes when the session has
ended the lock will free. I don't however have any experience with this and
don't even know if this will work. The code won't be a problem its just
whether this process will actually work.
I am thinking that I code put the order_id into a session variable then when
the session variable ends i run a sub in the .asa file that gets the session
variable and updates the table.

View Replies !
Global.asa File
I am in much need of some help with my global.asa file. I use ASP and mySQL. In a nutshell, When a registered user logs in, a field in I have a field that gets updated in my DB Table. It is a TINYINT. When they log in, it updates the value to 1, when they log out, it updates it to 0. I use a tiny iFrame to create a loop displaying users with the value of 1. Basically a cheasy "Who's Online" function.

How ever I am now trying to create a global.asa file to say when the session times out, I want the global file to just update the value back to 0. I am also attempting it so that if the users browser window closes and then gets reopened PRIOR to the timeout limit, It knows they are still logged in. I can provide my script if anyone thinks they can help. !!!!!!!!!!!!!!!!!!!

I think my final thought would be that when the user closes their browser, that the session ends and the DB field gets updated from a 1 to a 0.

View Replies !
Updating Db On Global
i'm trying to update my db when the user sessions expires..... So i put the codes below on the golbal.asa file... i tried it a few times but this code wont work... but when i tried in Sub session_on_start it is okay... i notice that we could not use server.mappath or any other objects/variable other than Session or Application variable on global.asa .... have any of u guyz trtied the same thing and works

<script language="vbscript" runat="server">
Sub Session_OnEnd

set adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open "Driver=MySQL ODBC 3.51 Driver; Database=dhl_21Feb; Uid=user;Pwd=user;"
set rssession = adoConn.execute("Update session set LogoutTime = '10.20',status = 'Log_'")

View Replies !
Global ASA Issues
I would like to start using the global.asa file on an ASP app to store
information like connection strings, contact e-mail addresses, etc. However,
the person I report to is nervous about this, mostly because he's never been
exposed to it.
He is of the opinion (because he "thinks he heard somewhere") that
application variables - and the ASA file in general - is bad. He's giving me
a bit of push-back until I can satisfy him that introducing this won't cause
problems for the site.
Anything I could find on the MSDN just says how to use it, how it works,
etc...which is stuff I already know. Has anyone had any problems with the ASA
file? Does it cause any performance lagging? Is there any chance that the
Application_OnStart event won't fire?

View Replies !
Global Variable
If i want to declare a global variable in a one page and can be retrieved anyway in any page. how can i do that? the normal one that we declare is :

dim execno
dim month

but what about the global variable???


View Replies !
Global.asa In Subdirectory
I have a site wich is in a subdirectory of the webSite. I have to use a global.asa file to set session.timeOut even i create an IIS application on the subDirectory global.asa don't run ?!?

if i create a virtual directory instead of IIS application, the global.asa run fine.
How can i do to run global.asa on a subDirectory ?

View Replies !
Is It Possible To Change Global.asa From Asp
With global.asa application variables can be set. Later can a script in your
application change the value of those variables. But when IIS is restarted
the old values are used again. Is there a way to get the changes that are
done into global.asa?

View Replies !
Global.asa Not Execute
my global.asa file doesn't seem to be executing in IIS and i don't know how to make them run. Any ideas how to execute the global.asa file in IIS 5.1 ,

View Replies !
Question On Global.asa
I have to write Global.asa with session_onEnd. Firstly, If my IIS have a number of application, may I have a number of global.asa on each application folder? or, i can just have a global.asa on the wwwroot?

Besides, I found that it seems doesn't run when I put global.asa on the application folder.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved