Please help with setting a cookie! [message #241769] |
Wed, 30 May 2007 10:30 |
lotusdeva
Messages: 201 Registered: March 2005
|
Senior Member |
|
|
Ok, I have never done this, so I am totally lost I basically have to set a cookie on a site and then redirect the user to a different app. This is how my cookie proc looks like:
PROCEDURE P_SetCookie IS
v_cookie owa_cookie.cookie;
v_uuid RAW(16);
BEGIN
--Call fun-n to get UUID (basically selects sys_guid()
-- from dual.
v_uuid := F_ReturnUUID();
v_cookie := owa_cookie.get('SSO_EFA');
--FALSE value in mime_header keeps the header open
--so we can insert the cookie into the header section
owa_util.mime_header('text/html', FALSE);
--This cookie will expire every 5 seconds --5/24/60/60
OWA_COOKIE.SEND('SSO_EFA',v_uuid, sysdate + 5/24/60/60
, '/', '.odu.edu');
owa_util.http_header_close;
htp.para;
htp.bold( 'Value of cookie ' || v_cookie.num_vals );
htp.para;
IF (v_cookie.num_vals > 0)
THEN
htp.bold( 'cookie is set and is ' || v_cookie.vals(1) );
ELSE
htp.p( 'cookie is not set' );
END IF;
END P_SetCookie;
I call this procedure b4 I do any logic on my page. The cookie does not get set, as I get "Cookie is not set" with a cookie value of 0. Also, for some reason I get the following printed on top of the page:
Content-type: text/html; charset=ISO-8859-1 Set-Cookie: SSO_EFA=31B27C9DF94663EBE0440000BEA958CA; expires=Wednesday, 30-May-2007 19:17:56 GMT; path=/; domain=.odu.edu;
Value of cookie 0
To me it looks like the cookie never gets into a header and maybe that is why it does not get set? I have no idea if this is even the problem or if it is, how to put it into the header. Please advise. Thank you!
|
|
|
|
Re: Please help with setting a cookie! [message #241861 is a reply to message #241851] |
Wed, 30 May 2007 14:36 |
lotusdeva
Messages: 201 Registered: March 2005
|
Senior Member |
|
|
Thank you! I got it to set the cookie. Except that on the top of my page I now get this:
Content-type: text/html; charset=ISO-8859-1 Set-Cookie:SESSIONID=.........
Do you by chance know how to get rid of this thing so that it does not show on the page?
Thank you!
|
|
|
|