page-load/page-unload is a good place for database connections such as DacSession() connect / disconnect or table USE operations, as this will increase performance if a worker process is used to handle multiple requests.
Directive #code directive Foundation
Controls where code is emitted by the CxcBuilder
<%#code locality=<locality-name>%>
The #code directive is used to specify the locality of the code section following the directive. The supported locality tokens are described in the table below. The default locality is "page-render". The CxcBuilder automatically switches back to that locality after it has emitted the code section immediately following a #code directive.
Token | Description |
---|---|
page-init | Code section is injected at the end of the :Init() method of the page class |
page-load | Code section is injected into the :Load() method of the page class. :Load() is executed when the page binary is loaded into the worker process. |
page-unload | Code section is injected into the :Unload() method of the page class. :Unload() is executed when the page binary is unloaded from worker process. This usually occurs before the worker process gets recycled. The exact time is not determined. |
page-render*) | Code section is injected into the :Render() method of the page class. :Render() is where the HTML output (view content) is created. |
page-global | Code section is injected into the module header of the page class implementation file. Use this locality for defining your own functions, classes or static declarations. #include statements should also be placed in this locality. |
|
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.