ASNA WingsRPG™ Reference Manual |
Session Timeouts
This topic describes Session Timeouts, why they occur, how Wings handles them, and how developers can customize how they're handled.
When a Wings site accesses the IBM i, it starts a session like any 5250 terminal or emulator, however since Wings runs a in a web browser instead of a terminal session, it is possible to close the browser or navigate to another page without properly ending the session and any jobs attached to it. This may lead to system resources being tied up or files being locked to the user of the abandoned session.
Warning – There is no built-in visual cue that a session timeout has occurred. This means that a timed-out user can still fill in fields, but may not be aware that their session has ended until they attempt to submit information.
By default Wings pages use the ASP.NET standard of timing out after 20 minutes of inactivity. Inactivity, in this case, refers strictly to information being passed to the server; only clicking the submit button or otherwise sending messages to the IBM i will reset the timer, mouseclicks and information entered into fields will not. The preferred method of changing this setting is through the Microsoft Internet Information Services (IIS) Manager GUI. In Windows 7, open the Start menu – IIS Manager – Session State then locate the Time-out (minutes) field under Cookie Settings, then click Apply on the right. Whatever number you set will be passed as a parameter of the sessionState Timeout method in the web.config.

Note – In order to access this GUI, you must have the IIS Manager, as well as its .NET Extensibility and ASP.NET components, installed and active. In Windows 7, you can add all the required components through the Turn Windows Features on or off dialog.
The sessionState.Timeout
method can also be applied in either
the web.config or the global.asax files. In global.asax,
it should be placed into the session_start
, but it's possible to
put it under application_start
.
In the web.config file, the sessionState.timeout
method can be
set inside the <system.web> tag, as shown below.
<configuration> <system.web> <sessionState mode="InProc" cookieless="true" timeout="30" /> </system.web> </configuration>
Once the Timeout
method is triggered, it will call
Session_end
(defined in global.asax).
Within Session_end
, the ASNA Monarch Framework implementation handles this event by calling
the Job.Request
method, which will trigger
code to prepare the application
for shutdown (eventually closing the DataGate connection). The
default parameter passed is set to 20 which tells the Job.Request
process to wait up to 20 seconds for the application to finish
cleanup. In the case of Monarch applications, all the active programs will be disposed. Normally disposing of a Monarch Program will
close all the open files and write any active DataAreas. If you anticipate that the process of disposing all
programs may take longer than 20 seconds, consider increasing this value. If the 20 second wait expires, the Monarch programs will
be forcibly terminated, and the DataGate connection will be closed.
Sessions can also be terminated immediatetely by using the
session.abandon
method, or guiding a browser to the EoJ.aspx
script, which calls the abandon method and displays
Monarch/!ExpiredSession.html. Developers can modify this (static
HTML) file to customize its appearance and the message it
displays.