Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » pass a cookie from one dad to another (Oracle 9i and Apache)
pass a cookie from one dad to another [message #327525] Mon, 16 June 2008 14:16 Go to next message
rdebruyn
Messages: 17
Registered: June 2008
Location: Ottawa
Junior Member
I'm able to lay a cookie and pass it from say customer.server.com to maps.server.com, but I want to pass one from say customer.server.com/pls/firstdad to customer.server.com/pls/seconddad.

I use owa_cookie.send and have tried values for the path parameter of:
NULL
/
/pls
/pls/
*
/pls/*

None seems to work. I'm not sure of the way cookies work and this may not even be possible to be done.

I'm controlling access per building. The plan is to have each building have a dad. The application sets the current building by selecting the one with the current dad = the building's dad_name attribute.
Re: pass a cookie from one dad to another [message #328348 is a reply to message #327525] Thu, 19 June 2008 16:59 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
The DAD should fall within the "path", not the "domain" (dumping the web environment using owa_util.print_cgi_env should confirm that).

If that's the case, you should just be able to set the cookie at the doain level using path=/ . The way I "passed a cookie" from one domain to another was by using a redirect via a GET URL having the cookie content. That way domain1 passes something to domain2 via URL and domain2 sets the cookie. You need to consider URL tamperering though....


   -- Calls to the procedure SEND generate an HTTP header line
   -- of the form:
   -- Set-Cookie: <name>=<value> expires=<expires> path=<path>
   --             domain=<domain> [secure]
   -- Only the name and value are required (as per the HTTP_COOKIE spec),
   -- and the default is non-secure.
   -- Calls to SEND must fall in the context of an OWA procedure's
   -- HTTP header output.  For example:

   -- begin
   --    owa_util.mime_header('text/html', FALSE);
   --                -- FALSE indicates not to close the header
   --    owa_cookie.send('ITEM1','SOCKS');
   --    owa_cookie.send('ITEM2','SHOES');
   --    owa_util.http_header_close;
   --
   --    -- Now output the page the user will see.
   --    htp.htmlOpen;
   --    <etc>
   procedure send(name    in varchar2,
                  value   in varchar2,
                  expires in date     DEFAULT NULL,
                  path    in varchar2 DEFAULT NULL,
                  domain  in varchar2 DEFAULT NULL,
                  secure  in varchar2 DEFAULT NULL);
Re: pass a cookie from one dad to another [message #328388 is a reply to message #328348] Fri, 20 June 2008 00:52 Go to previous message
rdebruyn
Messages: 17
Registered: June 2008
Location: Ottawa
Junior Member
I set the domain and tried different values for path including /.

The one thing I did that I may not have mentioned was to set an expires to make a persistent cookie.

If I go to customer.server.com/pls/firstdad no cookie is found so I have them log in. I navigate to customer.server.com/pls/seconddad and no cookie is found so they have to log in again. When I navigate back to customer.server.com/pls/firstdad, it finds the persistent cookie.
Previous Topic: cursor bulk collect
Next Topic: Retrieve user ID from the current Oracle session
Goto Forum:
  


Current Time: Thu Mar 28 13:27:52 CDT 2024