Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Global events

Events.After application initialized

Scroll Prev Next More

Description

The AfterAppInit event is executed after the application is initialized, before any other event.

 

 

Note: It is not recommended to use this event to display anything on the web page. Doing so may break your application.

Syntax

public XVar AfterAppInit()

Applies to pages

All pages.

 

If you need to interact with the database in this event, use Database API methods.  

Example

Let's say you need to troubleshoot your application by printing all SQL queries on the page.

 

By using the AfterAppInit event, you can display the debug info by adding debug=true to the URL. Make sure that you only use this kind of code in development and remove it before publishing your application to production.

AfterAppInit code:

if (MVCFunctions.postvalue("debug") == "true")
  GlobalVars.dDebug = true;

 

Sample URL: categories/list?debug=true.

 

Recommended predefined actions and sample events:

Send a simple email

Display a message on the Web page

Redirect to another page

Restrict access to ASPRunner.NET application by IP address

See also:

Query Designer tab

SQLQuery screen

About SQLQuery API

Troubleshooting tips