Toon posts:

[ASP] in global.asa functies plaatsen

Pagina: 1
Acties:

Verwijderd

Topicstarter
Mag je in een global.asa zelf ook functies schrijven, die je dan bijv. vanuit Session_OnEnd aanroept??

Zo niet dan weet ik waar de fout zit :) Zo ja dan moet ik maar weer verder gaan debuggen.

Verwijderd

Topicstarter
Stel ik een domme vraag waar niemand zin heeft om op te reageren :?

Of heeft iedereen net als mij geen idee?

  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 15-09 11:04

Basszje

Reisvaap!]

Volgens mij niet nee. De enige functies die mogen zijn dus session_onstart, session_onend, application_onstart, application_onend.

Global.asa is ook niet echt bedoeld voor het schrijven van grote functies oid .

Je zou wel bv in je default.asp per sessie kunnen checken of die net is aangemaakt of niet en dan daar je functionaliteiten gooien .

edit:

En topic schoppen na een uurtje is niet altijd nodig blijkbaar :)

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


Verwijderd

Het kan wel, zie http://www.w3schools.com/asp/asp_globalasa.asp
And you can include functions in the Global.asa file.

In the example below the Application_OnStart subroutine occurs when the Web server starts. Then the Application_OnStart subroutine calls another subroutine named getcustomers. The getcustomers subroutine opens a database and retrieves a set of records from the customers table. The recordset is assigned to an array, where it can be accessed from any ASP page without querying the database:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script language="vbscript" runat="server">
sub Application_OnStart
getcustomers
end sub
sub getcustomers 
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set rs=conn.execute("select name from customers")
Application("customers")=rs.GetRows
rs.Close
conn.Close
end sub
</script>
Enjoy :)

Verwijderd

Topicstarter
Op maandag 03 december 2001 13:02 schreef MrX het volgende:
Het kan wel, zie http://www.w3schools.com/asp/asp_globalasa.asp
[..]

Enjoy :)
Ik heb het doorgenomen, maar vreemd genoeg werkt het bij mij niet?? Kots ik dezelfde code bij Session_OnEnd erbij i.p.v. dan doet ie het wel.
Ik denk dat ik zo maar laat.

  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 15-09 11:04

Basszje

Reisvaap!]

Op maandag 03 december 2001 14:00 schreef SlowMo het volgende:

[..]

Ik heb het doorgenomen, maar vreemd genoeg werkt het bij mij niet?? Kots ik dezelfde code bij Session_OnEnd erbij i.p.v. dan doet ie het wel.
Ik denk dat ik zo maar laat.
Hoe je er rekening mee dat application ook maar eens per 'application' wordt geladen ? En je dan niet altijd de veranderingen snel ziet ?

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.

Pagina: 1