Is public Session zero active?

Yesterday i needed to find out if the current page of an application is rendered using the public Session 0 (zero).

Seems to be a trivial task, simply look up :APP_SESSION and there you find ……a very big number. Even if the URL clearly shows that session 0 is used :APP_SESSION delivers the “real” internal session-id.

So how do you know if session zero is used?

At first i started to parse the actual URL and filter out the session-id. You can access the URL with OWA_UTIL.GET_CGI_ENV(‘QUERY_STRING’) . That works, but is too complicated when there is an easier possibility.

A look into the APEX_APPLICATION package reveals the global variable g_use_zero_sid which returns boolean indicating whether session zero is used, or not.

So if you want to know if the current page runs session zero, simply check APEX_APPLICATION.g_use_zero_sid .

Of course this is undocumented and might change in future releases, so use carefully and on your own risk.

But honestly, i don’t think this is going to change soon, since the packages modification history states this variable exist since 2006:

--      sspadafo  04/22/2006 - Added g_use_zero_sid for zero session ID feature

  1. Tom van der Duin on February 6, 2015

    Hi Peter,

    There is a substitution variable APP_SESSION_VISIBLE that gives the same session_id as APP_SESSION, however it returns ’0′ when users are not authenticated to an application and they are using the Zero Session ID feature of Apex: See That’s documented; isn’t that a better option than using package variabel apex_application.g_use_zero_sid?

  2. Peter Raganitsch on February 6, 2015

    Thanks Tom, haven’t seen that before. Do you know since when this is available?

  3. Tom van der Duin on February 6, 2015

    I think it’s new in 4.2. The docs for 4.1 doesn’t mention it: