Show/Hide Toolbars

Navigation: Advanced topics > Events > Global events

ASPrunnerPro32x32     ASPRunnerPro manual

Event: AfterAppInit

Scroll Prev Next More




Function AfterAppInit is executed in the beginning of each page before any processing takes place. Use this event to override any global ASPRunnerPro variables. See help area in Event editor for the list of available global variables.


yellowbulbNote: It's not recommended to display anything on the web page from this event. This may break your application.






Applies to pages


All pages




Lets say you need to troubleshoot your application displaying executed SQL query on the top of the page. Usually you proceed to include/appsettings.asp file and set dDebug variable to true though changing this variable back and forth is a little or no joy.


Using AfterAppInit event you can display debug info simply adding debug=true to the URL.


AfterAppInit code:


if Request.QueryString("debug")="true" then
end if


Sample URL: categories_list.asp?debug=true




Database connection is not yet open in this event. If you need to perform any database operations open database connection manually.




set dbConnection = server.CreateObject("ADODB.Connection")
dbConnection.ConnectionString = strConnection
dbConnection.Execute "insert into log (LastAcccessTime) values(now())"
dbConnection.Close : set dbConnection = Nothing


Recommended sample events


Restrict access to ASPRunnerPro application by IP address