Can someone explain this behavior?? (session 0 with htp.init)
reggiehMar 19 2009 — edited Mar 20 2009Hi,
I've noticed that when you access a page using the Session 0 and that page contains an "htp.init" in a before header process, for some reason the session expires and creates a new one.
I made an example on apex.oracle.com, but first let me explain what've done exactly.
There's two pages. On page 1, I have an item named :P1_COLOR that is assigned the value of an application item :P_RED. This application item is affected in an application process before header that runs only on page 1 (the value assigned is "This is red"). I also have an item that displays the session id using this code:
return :APP_SESSION;
Then, I have a link called "page 2" in the HTML region :
a href="f?p=&APP_ID.:2:&APP_SESSION.:::::">page 2</a
Also, more importantly, on page 1 I have a process before header that sets a cookie:
begin
htp.init;
owa_util.mime_header('text/html', FALSE);
owa_cookie.send(
name => 'MY_COLOR_COOKIE_'||:P_RED,
value => 'test_value',
expires => SYSDATE365,+
path => null,
domain => null );
owa_util.mime_header('text/html', TRUE);
END;
Now if you go in the application normally without session 0, you will see the "This is red" with the session id and when you click on page 2 you will still see "This is red" with the same session ID
http://apex.oracle.com/pls/otn/f?p=60310:1::::::
But when using the Session 0, you see "This is red" with a session id, but when you click page 2, you don't see "This is red" and a new session ID is created, but the link in the address bar still contains the session 0. Also, if you press BACK and then go on page 2 again, you don't lose the :P_RED value nor the session. There seems to be a problem only the first time around.
http://apex.oracle.com/pls/otn/f?p=60310:1:0:::::
Can anyone explain me this behavior? Is it a bug? What is the work around? Because, i know that if you want to set a cookie you need "htp.init".
Note: I 've commented the cookie part of my process and only left the htp.init uncommented and had the same result, that's why I'm saying it is caused by htp.init
Thanks, reginald
Edited by: reggieh on Mar 19, 2009 7:09 AM